Key takeaway
- A practical guide to Go application performance monitoring: runtime metrics, pprof, tracing, OpenTelemetry, APM tools and what AI agents add to operations.
Go application performance monitoring is the practice of collecting runtime metrics, traces, profiles and logs from a Go service so you can see how it behaves in production and find slow requests, memory growth and goroutine leaks before users do. It combines what the Go runtime exposes itself with an agent or collector that sends data to a monitoring platform.
This guide is for Go developers, platform engineers and DevOps leads who run Go services and need a practical map of what to measure, which tools fit, and what to set up first. It covers the built-in diagnostics, the metrics that matter, how monitoring platforms differ, and how AI agents change the work.
What does Go application monitoring cover?
The official Go diagnostics guide groups the tooling into four areas: profiling, tracing, debugging, and runtime statistics and events. Monitoring in production mostly draws on three of them, and a good setup answers four questions: is the service healthy, where is time spent, what is it allocating, and what changed after a deploy?
| Area | What Go documents | Typical tools |
|---|---|---|
| Profiling | Analyses the complexity and cost of a program, such as memory use and frequently called functions | runtime/pprof, net/http/pprof, go tool pprof |
| Tracing | Instruments code to analyse latency through the lifecycle of a call or user request, including across processes | Execution tracer, distributed tracing libraries |
| Debugging | Pauses a program to examine its execution | Delve, core dumps |
| Runtime statistics | A high-level view of the health of a Go program | runtime.ReadMemStats, runtime.NumGoroutine, GODEBUG |
Which Go metrics should you watch?
The runtime/metrics package provides what its documentation calls a stable interface to metrics exported by the Go runtime. Metrics are identified by string keys made of a path and a unit, for example /sched/goroutines:goroutines for the count of live goroutines. The package covers goroutines, garbage collection (cycle counts, pause latency and CPU time on GC work) and heap (live bytes, heap goal, allocation totals and object counts).
- Goroutine count: a steadily rising count is the classic sign of a leak. The Go guide names
runtime.NumGoroutinefor detecting leaks. - Heap and GC: memory in use, allocation rates and pause behaviour show whether memory management is under strain. The guide points to
runtime.ReadMemStatsfor catching leaks anddebug.ReadGCStatsfor pause times. - Request rate, errors and latency: these come from your own instrumentation or an agent, not from the runtime.
- CPU, memory and network at host level: use your infrastructure monitoring for these.
The Go guide also gives two cautions. It is safe to profile in production, but some profiles, such as the CPU profile, add cost, and it recommends collecting only one profile at a time. Tools can also interfere: precise memory profiling skews CPU profiles, so use tools in isolation.
How do you instrument a Go service?
The Go guide notes that Go does not automatically intercept every function call to create trace spans, so you instrument code to create, end and annotate spans. OpenTelemetry for Go offers manual instrumentation for traces, metrics and logs, and its page lists traces and metrics as stable and logs at release candidate stage. Check that page for the current status before you standardise.
Go also makes it simple to expose an HTTP endpoint inside any application, which is how many teams publish custom metrics for a collector to scrape, such as queue depth or backup job status. Our guide to performance monitoring tools and management and the overview of cloud management and monitoring tools cover the platform side.
How do monitoring platforms for Go compare?
Several commercial platforms offer Go support. Features and agents change often, so confirm details on each vendor's own documentation. The New Relic Go agent introduction is one example: it says the agent monitors Go applications and microservices, recommends using the Go API to instrument your code, and offers a simpler option of importing the agent and creating an application to get basic runtime data. It reports goroutine counts, garbage collection statistics, memory and CPU usage, transaction throughput, response times and errors, and time spent on database and external calls.
| Approach | Strength | Trade-off |
|---|---|---|
| Built-in diagnostics (pprof, runtime metrics) | No vendor, free to use, precise for one process | You build storage, dashboards and alerting yourself |
| OpenTelemetry instrumentation | Open, portable between backends | Instrumentation is manual and needs design |
| Commercial APM agent (for example New Relic) | Dashboards, alerts and tracing in one product | Cost and lock-in; still best with code instrumentation |
How do AI agents change Go application monitoring?
Monitoring produces signals, and people still do the triage. AI agents can read alerts, pull the relevant traces and profiles, propose a cause and open a ticket or a rollback request for approval. That only works if the signals are clean and consistent, which is why the instrumentation above matters first. ElixirClaw, the AI agents computing platform, is where XenonStack builds and runs agents for DevOps and automation work such as this. For release flow, read about application release orchestration and serverless application development.
What related Go topics help?
Good monitoring sits on good engineering. Read about Golang unit testing, microservices for Java and Golang, Golang for big data and parallel processing and Golang package management. For wider application development and management, explore our enterprise solutions.
What should you do first?
- Expose goroutine, heap and GC metrics from the Go runtime on every service.
- Add request rate, error and latency instrumentation to the main endpoints.
- Enable net/http/pprof carefully and collect one profile at a time when investigating.
- Add distributed tracing across the services that call each other.
- Set alerts on goroutine growth, error rate and latency, and mark each deployment.
To map one decision your agents make, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is Go application monitoring?
It is collecting runtime metrics, traces, profiles and logs from Go services to understand production behaviour and find slow requests, memory growth and goroutine leaks.
What does Go provide for diagnostics?
The Go diagnostics guide covers profiling, tracing, debugging, and runtime statistics and events, with tools such as pprof, the execution tracer and Delve.
How do I detect a goroutine leak?
Watch the goroutine count over time, for example with runtime.NumGoroutine or the runtime/metrics goroutine metric, and look for a count that keeps rising.
Is it safe to profile a Go service in production?
The Go guide says it is safe, but some profiles such as CPU add cost, and it recommends collecting only one profile at a time.
Do I need a commercial APM tool?
Not necessarily. Built-in diagnostics and OpenTelemetry cover a lot, while commercial agents add dashboards, alerting and tracing in one place at a cost.
Ready to put AI agents to work? See an ElixirClaw demo: the agentic OS to build, orchestrate and govern AI agents across your enterprise systems.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE