• Stars
    star
    719
  • Rank 60,791 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

New Relic Go Agent

Community Plus header

New Relic Go Agent GoDoc Go Report Card

The New Relic Go Agent allows you to monitor your Go applications with New Relic. It helps you track transactions, outbound requests, database calls, and other parts of your Go application's behavior and provides a running overview of garbage collection, goroutine activity, and memory use.

Go is a compiled language, and doesnโ€™t use a virtual machine. This means that setting up New Relic for your Golang app requires you to use our Go agent API and manually add New Relic methods to your source code. Our API provides exceptional flexibility and control over what gets instrumented.

Installation

Compatibility and Requirements

For the latest version of the agent, Go 1.17+ is required.

Linux, OS X, and Windows (Vista, Server 2008 and later) are supported.

Installing and using the Go agent

To install the agent, follow the instructions in our GETTING_STARTED document or our GUIDE.

We recommend instrumenting your Go code to get the maximum benefits from the New Relic Go agent. But we make it easy to get great data in couple of ways:

  • Even without adding instrumentation, just importing the agent and creating an application will provide useful runtime information about your number of goroutines, garbage collection statistics, and memory and CPU usage.
  • You can use our many INTEGRATION packages for out-of-the box support for many popular Go web frameworks and libraries. We continue to add integration packages based on your feedback. You can weigh in on potential integrations by opening an Issue here in our New Relic Go agent GitHub project.

Upgrading

If you have already been using version 2.X of the agent and are upgrading to version 3.0, see our MIGRATION guide for details.

Getting Started

v3/examples/server/main.go is an example that will appear as "Example App" in your New Relic applications list. To run it:

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

Some endpoints exposed are http://localhost:8000/ and http://localhost:8000/notice_error

Usage

Integration Packages

The following integration packages extend the base newrelic package to support the following frameworks and libraries. Frameworks and databases which don't have an integration package may still be instrumented using the newrelic package primitives.

Service Frameworks

Project Integration Package
gin-gonic/gin v3/integrations/nrgin Instrument inbound requests through the Gin framework
gorilla/mux v3/integrations/nrgorilla Instrument inbound requests through the Gorilla framework
google.golang.org/grpc v3/integrations/nrgrpc Instrument gRPC servers and clients
labstack/echo v3/integrations/nrecho-v3 Instrument inbound requests through version 3 of the Echo framework
labstack/echo v3/integrations/nrecho-v4 Instrument inbound requests through version 4 of the Echo framework
julienschmidt/httprouter v3/integrations/nrhttprouter Instrument inbound requests through the HttpRouter framework
micro/go-micro v3/integrations/nrmicro Instrument servers, clients, publishers, and subscribers through the Micro framework

Datastores

More information about instrumenting databases without an integration package using newrelic package primitives can be found here.

Project Integration Package
lib/pq v3/integrations/nrpq Instrument PostgreSQL driver (pq driver for database/sql)
jackc/pgx v3/integrations/nrpgx Instrument PostgreSQL driver (pgx driver for database/sql)
jackc/pgx/v5 v3/integrations/nrpgx5 Instrument PostgreSQL driver (pgx/v5 driver for database/sql)
go-mssqldb v3/integrations/nrmssql Instrument MS SQL driver
go-sql-driver/mysql v3/integrations/nrmysql Instrument MySQL driver
elastic/go-elasticsearch v3/integrations/nrelasticsearch-v7 Instrument Elasticsearch datastore calls
database/sql Use a supported database driver or builtin instrumentation Instrument database calls with SQL
jmoiron/sqlx Use a supported database driver or builtin instrumentation Instrument database calls with SQLx
go-redis/redis v3/integrations/nrredis-v7 Instrument Redis 7 calls
go-redis/redis v3/integrations/nrredis-v8 Instrument Redis 8 calls
redis/go-redis v3/integrations/nrredis-v9 Instrument Redis 9 calls
mattn/go-sqlite3 v3/integrations/nrsqlite3 Instrument SQLite driver
snowflakedb/gosnowflake v3/integrations/nrsnowflake Instrument Snowflake driver
mongodb/mongo-go-driver v3/integrations/nrmongo Instrument MongoDB calls

Agent Logging

Project Integration Package
sirupsen/logrus v3/integrations/nrlogrus Send agent log messages to Logrus
mgutz/logxi v3/integrations/nrlogxi Send agent log messages to Logxi
uber-go/zap v3/integrations/nrzap Send agent log messages to Zap

Logs in Context

Project Integration Package
sirupsen/logrus v3/integrations/logcontext-v2/nrlogrus Send data collected from Logrus log messages to New Relic
log v3/integrations/logcontext-v2/logWriter Send data collected from the standard library logger log messages to New Relic
rs/zerolog v3/integrations/logcontext-v2/zerologWriter Send data collected from zerolog log messages to New Relic

AWS

Project Integration Package
aws/aws-sdk-go v3/integrations/nrawssdk-v1 Instrument outbound calls made using Go AWS SDK
aws/aws-sdk-go-v2 v3/integrations/nrawssdk-v2 Instrument outbound calls made using Go AWS SDK v2
aws/aws-lambda-go v3/integrations/nrlambda Instrument AWS Lambda applications

GraphQL

Project Integration Package
graph-gophers/graphql-go v3/integrations/nrgraphgophers Instrument inbound requests using graph-gophers/graphql-go
graphql-go/graphql v3/integrations/nrgraphqlgo Instrument inbound requests using graphql-go/graphql

Misc

Project Integration Package
pkg/errors v3/integrations/nrpkgerrors Wrap pkg/errors errors to improve stack traces and error class information
openzipkin/b3-propagation v3/integrations/nrb3 Add B3 headers to outgoing requests
nats-io/nats.go v3/integrations/nrnats Instrument publishers and subscribers using the NATS client
nats-io/stan.go v3/integrations/nrstan Instrument publishers and subscribers using the NATS streaming client

These integration packages must be imported along with the newrelic package, as shown in this nrgin example.

Alternatives

If you are already using another open source solution to gather telemetry data, you may find it easier to use one of our open source exporters to send this data to New Relic:

Support

Should you need assistance with New Relic products, you are in good hands with several support channels.

If the issue has been confirmed as a bug or is a Feature request, please file a Github issue.

Privacy

At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.

We define "Personal Data" as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address.

For more information, review New Relicโ€™s General Data Privacy Notice.

Contribute

We encourage your contributions to improve the Go Agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at [email protected].

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, please review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to the Go Agent.

License

The New Relic Go agent is licensed under the Apache 2.0 License.

More Repositories

1

centurion

A mass deployment tool for Docker fleets
Ruby
1,744
star
2

newrelic-ruby-agent

New Relic RPM Ruby Agent
Ruby
1,180
star
3

node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
JavaScript
927
star
4

rusty-hog

A suite of secret scanners built in Rust for performance. Based on TruffleHog (https://github.com/dxa4481/truffleHog) which is written in Python.
Rust
392
star
5

sidecar

Gossip-based service discovery. Docker native, but supports static discovery, too.
Go
259
star
6

elixir_agent

New Relic's Open Source Elixir Agent
Elixir
251
star
7

terraform-provider-newrelic

Terraform provider for New Relic
Go
199
star
8

rpm_contrib

Extra Instrumentation for the New Relic RPM Gem
192
star
9

newrelic-java-agent

The New Relic Java agent
Java
183
star
10

docs-website

Source code for @newrelic docs. We welcome pull requests and questions on our docs!
MDX
164
star
11

newrelic-python-agent

New Relic Python Agent
Python
156
star
12

newrelic_aws_cloudwatch_plugin

New Relic AWS Cloudwatch Plugin
Ruby
154
star
13

check_docker

A Go Nagios check for Docker
Go
126
star
14

newrelic-cli

The New Relic Command Line Interface
Go
121
star
15

newrelic_api

Documentation, Active Resource Helper, and test code for the RPM REST API
Ruby
119
star
16

opensource-website

Source code for New Relic's Opensource site.
JavaScript
105
star
17

nri-flex

An application-agnostic, all-in-one New Relic integration integration
Go
104
star
18

newrelic-php-agent

The New Relic PHP Agent
C
103
star
19

infrastructure-agent

New Relic Infrastructure Agent
Go
102
star
20

newrelic-quickstarts

New Relic One quickstarts help accelerate your New Relic journey by providing immediate value for your specific use cases.
TypeScript
102
star
21

infrastructure-agent-ansible

Ansible role for installing New Relic Infrastructure agent
Python
95
star
22

helm-charts

Helm charts for New Relic applications
Smarty
93
star
23

newrelic-opentelemetry-examples

Examples for sending OpenTelemetry sourced data to New Relic.
Java
89
star
24

nr1-workshop

Self-paced training workshop for the NR1 CLI/SDK
JavaScript
86
star
25

newrelic_mysql_java_plugin

MySQL Metrics Plugin
Java
79
star
26

newrelic-dotnet-agent

The New Relic .NET language agent.
C#
74
star
27

newrelic-node-nextjs

New Relic Next.js instrumentation for the Node Agent
JavaScript
73
star
28

newrelic-lambda-extension

An AWS Lambda Extension to collect, enhance and transport telemetry to New Relic for AWS Lambda functions without requiring an external transport such as CloudWatch Logs or Kinesis.
Go
71
star
29

newrelic-client-go

New Relic Client for the Go programming language
Go
68
star
30

newrelic-browser-agent

New Relic Browser Agent
HTML
63
star
31

entity-definitions

The definition files contained in this repository are mappings between the telemetry attributes NewRelic ingests, and the entities users can interact with. If you have telemetry from any source that is not supported out of the box, you can propose a mapping for it by opening a PR.
JavaScript
62
star
32

node-native-metrics

Optional native module for collecting low-level Node & V8 metrics
C++
58
star
33

k8s-webhook-cert-manager

Generate certificate suitable for use with any Kubernetes Mutating Webhook.
Shell
58
star
34

c-sdk

New Relic C SDK
C
57
star
35

newrelic-node-apollo-server-plugin

JavaScript
53
star
36

deployment-marker-action

Github Action for recording a Deployment Marker in New Relic
Shell
50
star
37

absinthe-schema-stitching-example

Absinthe Schema Stitching Example
Elixir
49
star
38

aws-log-ingestion

AWS Serverless Application that sends log data from CloudWatch Logs to New Relic Infrastructure - Cloud Integrations.
Python
48
star
39

nr1-cloud-optimize

NR1 Cloud Optimize allows you to Identify right-sizing opportunities and potential savings of your AWS, GCP, and Azure instances across your cloud environment.
JavaScript
47
star
40

serverless-newrelic-lambda-layers

A Serverless plugin to install New Relic's AWS Lambda layers without requiring a code change.
TypeScript
46
star
41

newrelic-lambda-cli

A CLI to install the New Relic AWS Lambda integration and layers.
Python
45
star
42

infra-integrations-sdk

New Relic Infrastructure Integrations SDK
Go
45
star
43

go_nagios

Go lang package for writing Nagios checks
Go
43
star
44

newrelic-kubernetes-operator

Operator to create New Relic configuration in Kubernetes
Go
42
star
45

dPerf

Distributed Mobile CPU Profiling
Objective-C
41
star
46

newrelic-telemetry-sdk-go

Go library for sending telemetry data to New Relic
Go
40
star
47

developer-website

Source code for the New Relic Developer Site.
MDX
39
star
48

newrelic-telemetry-sdk-java

Java library for sending telemetry data to New Relic
Java
39
star
49

newrelic-diagnostics-cli

NrDiag is a command line diagnostics tool for New Relic Products that was created by and is maintained by New Relic Global Technical Support
Go
37
star
50

el-dorado-ui

Graph db query and rendering suitable for visualization of complex process structures
Ruby
37
star
51

newrelic-ruby-kata

Using New Relic and Heroku, see how many things you can find and fix to make this app perform fast!
Ruby
35
star
52

micrometer-registry-newrelic

ARCHIVED. TO SEND MICROMETER METRICS TO NEW RELIC, FOLLOW THE DIRECTION IN THE README.md. Micrometer registry implementation that sends data to New Relic as dimensional metrics.
Java
35
star
53

newrelic_microsoft_sqlserver_plugin

New Relic Microsoft SQL Server Plugin
C#
33
star
54

nri-prometheus

Fetch metrics in the Prometheus metrics inside or outside Kubernetes and send them to the New Relic Metrics platform.
Go
33
star
55

nri-kubernetes

New Relic integration for Kubernetes
Go
33
star
56

nr1-status-pages

NR1 Status Pages allows you to collect and display the statuses of key dependencies in one place.
JavaScript
33
star
57

papers

Validates licenses of your Rails dependencies against a whitelist
Ruby
31
star
58

opentelemetry-exporter-go

New Relic's Golang OpenTelemetry Exporter
Go
30
star
59

nr-openai-observability

Easy to install OpenAI GPT monitoring tool.
Python
30
star
60

tutone

Generate Golang code from GraphQL schema introspection
Go
30
star
61

extends_newrelic_rpm

Gems that extend New Relic's Ruby agent (newrelic_rpm), linked via git submodules
Ruby
29
star
62

newrelic_plugin

New Relic Ruby Plugin Agent SDK
Ruby
29
star
63

newrelic-jfr-core

JFR library that adapts JFR events to the New Relic Telemetry SDK
Java
29
star
64

newrelic-telemetry-sdk-python

A python library to send data to New Relic!
Python
29
star
65

infrastructure-agent-chef

Chef cookbook for installing New Relic Infrastructure agent
Ruby
28
star
66

nrjmx

Command line tool to connect to a JMX server and retrieve the MBeans it exposes.
Java
28
star
67

fluentd-examples

Sample FluentD configs
27
star
68

newrelic-lambda-layers

Source code and utilities to build and publish New Relic's public AWS Lambda layers.
Shell
27
star
69

dkenv

A docker version switcher
Go
26
star
70

newrelic-unix-monitor

Monitoring service for Unix (AIX, Linux, HP-UX, MacOS, Solaris) systems
Java
26
star
71

marlowe

Experimental project for investigating interesting visualizations of APM data
JavaScript
25
star
72

wiki-sync-action

A GitHub Action that synchronizes the contents of a directory to the repository's Wiki.
Shell
25
star
73

futurestack14_badge

Source code for the badges from New Relic's FutureStack 2014 conference
Squirrel
24
star
74

nr-jenkins-plugin

Jenkins Plugin to send metrics to New Relic
Java
24
star
75

newrelic-telemetry-sdk-rust

Rust library for sending telemetry data to New Relic
Rust
23
star
76

k8s-metadata-injection

Kubernetes metadata injection for New Relic APM to make a linkage between APM and Infrastructure data.
Go
23
star
77

newrelic-fluent-bit-output

A Fluent Bit output plugin that sends logs to New Relic
Go
22
star
78

newrelic-monolog-logenricher-php

Monolog components to enable New Relic Logs
PHP
22
star
79

agent_sdk_samples

Sample wrappers and code for the New Relic Agent SDK
C
22
star
80

nri-nginx

New Relic Infrastructure Nginx Integration
Go
21
star
81

nr1-slo-r

NR1 SLO-R allows you to define, calculate and report on service-level objective (SLO) attainment.
JavaScript
21
star
82

newrelic-airflow-plugin

Send airflow metrics to New Relic!
Python
20
star
83

newrelic-python-kata

Newrelic Python Kata
Python
20
star
84

newrelic_plugins_chef

Ruby
20
star
85

metrics_publish_java

New Relic Java Plugin Agent SDK
Java
20
star
86

newrelic-node-log-extensions

Source for the New Relic Node.js log framework extensions
JavaScript
20
star
87

newrelic-cordova-plugin

A Cordova plugin for the New Relic Mobile SDKs
JavaScript
19
star
88

newrelic-logenricher-dotnet

Extensions supporting New Relic Logging (Logs In Context)
C#
19
star
89

nr1-learn-nrql

NR1 learn NRQL helps New Relic Customers quickly learn our custom query language - NRQL
JavaScript
19
star
90

newrelic-cordova-ios

A PhoneGap / Cordova plugin for New Relic's iOS SDK
Objective-C
19
star
91

open-install-library

New Relic's open instrumentation installation recipe database and service
Shell
19
star
92

quickstarts-synthetics-library

Repositories containing example/templated synthetic scripts for use in New Relic.
JavaScript
19
star
93

gatsby-theme-newrelic

Source code for New Relic's Gatsby site theme.
JavaScript
19
star
94

nr1-browser-analyzer

NR1 Browser Analyzer allows you to understand the impact and performance of your website.
JavaScript
18
star
95

nr1-quickstarts

[ARCHIVED] Community repository of New Relic dashboards, alerts, and installation instructions.
JavaScript
18
star
96

supervisor-remote-logging

Use supervisord to relay your application's stdout/stderr to syslog.
Python
18
star
97

webinar

Contains the sample code for the "Best Practices for Measuring Your Code Pipeline" webinar
18
star
98

infrastructure-bundle

New Relic Infrastructure containerised agent bundle
Go
17
star
99

ruby-metaprogramming-challenge

A fun metaprogramming challenge created at New Relic
Ruby
16
star
100

newrelic_plugins_puppet

Puppet
16
star