# Tracepanel for Go (/docs/go)

[![Go Reference](https://pkg.go.dev/badge/github.com/tracepanel/tracepanel-go.svg)](https://pkg.go.dev/github.com/tracepanel/tracepanel-go)
[![Go](https://img.shields.io/badge/go-1.26%2B-blue)](https://pkg.go.dev/github.com/tracepanel/tracepanel-go)

Tracepanel for Go is the
[`github.com/tracepanel/tracepanel-go`](https://github.com/tracepanel/tracepanel-go)
module. It records each request of your app with its SQL, its log records, its
calls to HTTP APIs and Redis, its Kafka messages and its panics, what the
request carried and, when you ask, its CPU time and memory. It sends each trace
to the agent. The agent finds the issues and serves the panel and the console.

```bash
go get github.com/tracepanel/tracepanel-go@v0.10.0
```

```go
db, err := sql.Open(tracepanel.Driver("pgx"), dsn)
http.ListenAndServe(":8080", tracepanel.WrapHandler(mux))
```

It works with `net/http` and any router on it: `ServeMux`, chi, gorilla,
gin and Echo. It records any database on `database/sql`, pgx and GORM. The core
module has no dependencies. Each library integration is a module of its
own. Fiber runs on fasthttp, not `net/http`, and isn't supported yet.

Tracepanel records in development only: when the app runs under `go run`,
with `TRACEPANEL_ENABLED=1`, or with `Config.Enabled`. A binary built with
`go build` records nothing, unless you start it with `tracepanel run`.

<Cards>
  <Card title="Installation" href="/docs/go/installation" description="Add the module to your app and open the panel." />
  <Card title="Integrations" href="/docs/go/integrations" description="What Tracepanel records: routers, SQL, Redis, logs, calls, gRPC, Kafka, requests and profiles." />
  <Card title="Configuration" href="/docs/go/configuration" description="The Config fields, the environment variables and thresholds." />
  <Card title="Tracing your code" href="/docs/go/tracing-your-code" description="Span, Go, Command, SetUser and Dump." />
  <Card title="Command line" href="/docs/go/cli" description="A built app recording, and the agent's MCP server and console, through go run." />
</Cards>
