Repolode
newrelic

newrelic/go-agent

Go SDK for instrumenting Go applications and sending transactions, errors, and runtime metrics to New Relic.

Open-source alternative to:Datadog APM

Stars
839
Forks
319
Open issues
61
Last commit
yesterday

What is it?

The New Relic Go Agent is a library that adds monitoring to Go applications. It tracks transactions, outbound HTTP requests, database calls, and other parts of application behavior, and reports runtime data such as goroutine counts, garbage collection statistics, and memory and CPU usage. Because Go is compiled and has no virtual machine to hook into, instrumentation is added by calling the agent's API from source code.

Simply importing the agent and creating an application gives basic runtime visibility without further changes. For finer detail, the repository provides integration packages for common Go web frameworks such as Gin, Fiber, Echo, gRPC and Gorilla Mux, database drivers including pgx, MySQL, MongoDB and Redis clients, logging libraries like zap, logrus and slog, and AWS SDKs and Lambda. Frameworks without a dedicated package can still be instrumented with the core newrelic package primitives.

The agent requires Go 1.22 or later and supports Linux, macOS and Windows. It is licensed under Apache 2.0.

Key features

  • 01Tracks transactions, outbound requests, and database calls in Go applications.
  • 02Reports goroutine, garbage collection, memory, and CPU runtime metrics.
  • 03Provides integration packages for popular web frameworks, database drivers, and loggers.
  • 04Includes AWS SDK and AWS Lambda instrumentation.
  • 05Offers AI Monitoring events for OpenAI and AWS Bedrock calls.

Use cases

  • Monitoring the performance and errors of a Go web service built with Gin, Fiber, or Echo.
  • Tracing database query latency in a Go service that uses pgx or MySQL.
  • Adding observability to Go microservices communicating over gRPC.
  • Sending Go application logs with trace context to New Relic.

Quick start

  1. 1

    Install the agent by following the GETTING_STARTED guide

  2. 2

    Run the example server with your New Relic license key

    env NEW_RELIC_LICENSE_KEY=__YOUR_NEW_RELIC_LICENSE_KEY__LICENSE__ go run v3/examples/server/main.go

Things to know

  • Requires Go 1.22 or later for the latest version.
  • Instrumentation is added manually through the Go API calls in your source code rather than automatically.

In collections

Topics

FAQ

What is go-agent?
Go SDK for instrumenting Go applications and sending transactions, errors, and runtime metrics to New Relic. The New Relic Go Agent is a library that adds monitoring to Go applications. It tracks transactions, outbound HTTP requests, database calls, and other parts of application behavior, and reports runtime data such as goroutine counts, garbage collection statistics, and memory and CPU usage. Because Go is compiled and has no virtual machine to hook into, instrumentation is added by calling the agent's API from source code.
Is go-agent free to use? What license does it have?
go-agent is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is go-agent still maintained?
Actively maintained. The last commit to go-agent was on Nov 6, 2026.
What can I use go-agent for?
Monitoring the performance and errors of a Go web service built with Gin, Fiber, or Echo. Tracing database query latency in a Go service that uses pgx or MySQL. Adding observability to Go microservices communicating over gRPC. Sending Go application logs with trace context to New Relic.
How do I install go-agent?
Install the agent by following the GETTING_STARTED guide Run the example server with your New Relic license key: env NEW_RELIC_LICENSE_KEY=__YOUR_NEW_RELIC_LICENSE_KEY__LICENSE__ go run v3/examples/server/main.go
Where can I get go-agent?
The source code and installation instructions are on GitHub: https://github.com/newrelic/go-agent

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects