Monitoring Go

The Go Collector provides automated code instrumentation for supported technologies, zero configuration health monitoring of Go services, and end-to-end traces of requests across all systems.


Supported Runtimes

  • Go version 1.9 or later for Go Collector versions earlier than 1.47.0
  • Go version 1.13 or later for Go Collector versions 1.47.0 or later

Supported Frameworks and Libraries

To avoid adding unnecessary dependencies, Instana main module provides only instrumentation for packages that are a part of the Go standard library. Third-party package instrumentations are provided as separate modules found in and need to be added to go.mod separately.

Note: Trace continuity is not applicable to database and logging libraries.


Target Library Version Instrumentation Package Version Trace Continuity
net/http 1.51.0 4.9.0 1.6.0 1.7.7 1.5.0 1.8.0 1.6.0 1.3.0 1.4.0


Target Library Version Instrumentation Package Version Trace Continuity 1.15.0 1.4.0


Target Library Version Instrumentation Package Version
database/sql 1.51.0 1.7.2 1.4.0
jackc/pgx 4.14.1 0.5.0
go-redis 9.0.2 2.0.0
redigo 1.8.8 0.5.0
gorm 1.25.0 1.0.0


Target Library Version Instrumentation Package Version Trace Continuity 1.3.1 1.7.0 1.19.0 1.9.0 1.0.0 0.5.0 1.5.0 0.1.0


Target Library Version Instrumentation Package Version Trace Continuity
graphql-go/graphql 0.8.0 1.0.0


Target Library Version Instrumentation Package Version Trace Continuity 1.7.0 1.7.0 1.44.209 1.8.0 1.20.0 1.8.0 1.5.0 1.4.0

Runtime Metrics

Following metrics are collected and displayed on the Go process dashboard:

  • Memory usage
  • Heap usage
  • GC activity
  • Goroutines

Health Signatures

  • Calls
  • Response time
  • Scaling


The installation of the Instana Go collector is a simple two-step process. First, add module to your go.mod file:

go get

After the go-sensor module is added to your application dependencies, you can use the go-sensor module to instrument your application code. For more information, see Installation.

Note: Starting from version 1.53.0, Go Collector uses fsm v1.0.1 internally. If you are using fsm version before v1 in your projects, you might face compilation issues, and you need to update fsm version to v1.

Tracers Logs

The Go Collector uses a leveled logger to log internal errors and diagnostic information. The default logger.Logger uses log.Logger configured with log.Lstdflags as a backend and writes messages to os.Stderr. By default, this logger only prints out the ERROR level messages unless the environment variable INSTANA_DEBUG is set.

To change the min log level in runtime it is recommended to configure and inject an instance of instana.LeveledLogger:

l := logger.New(log.New(os.Stderr, "", os.Lstdflags))

// ...


The logger.LeveledLogger interface is implemented by such popular logging libraries as and, so they can be used as a replacement.

Alternatively, since version 1.39.0 of the Go sensor, the INSTANA_LOG_LEVEL environment variable can be used to set the log level.

Note: the value of INSTANA_DEBUG environment variable does not affect custom loggers. You'd need to explicitly check whether it's set and enable the debug logging while configuring your logger:

import (
	instana ""

func main() {
	// initialize Instana sensor
	instana.InitSensor(&instana.Options{Service: SERVICE})

	// initialize and configure the logger
	logger := logrus.New()
	logger.Level = logrus.InfoLevel

	// check if INSTANA_DEBUG is set and set the log level to DEBUG if needed
	if _, ok := os.LookupEnv("INSTANA_DEBUG"); ok {
		logger.Level = logrus.DebugLevel

	// use logrus to log the Instana Go Collector messages

	// ...


The Go collector supports serverless mode, when instead of a host agent, it sends metrics and traces to the serverless acceptor endpoint. To switch collector into a serverless mode, set the INSTANA_ENDPOINT_URL environment variable to the serverless acceptor URL of your Instana installation and provide your agent key via INSTANA_AGENT_KEY. Please refer to the Serverless Monitoring section to learn about other configuration options available in serverless mode.

AWS Fargate

Instana Go collector automatically detects if a service is running on AWS Fargate when running in a serverless mode.

Google Cloud Run

Instana Go collector automatically detects if a service is running on Google Cloud Run when running in a serverless mode.

AWS Lambda

Instana Go Collector supports tracing AWS Lambda function written in Go starting from v1.23.0. Handlers need to be instrumented using the package in order to collect and send trace data. Please refer to AWS Lambda Go documentation for details.

Azure Function

Instana Go Collector supports the tracing of Azure functions that are written in Go. Handlers need to be instrumented by using the package to collect and send trace data. For more information, see Azure Functions Tracing for Go.

Kubernetes & OpenShift

If your Go application and the Instana agent run in a Kubernetes cluster, check the documentation on Kubernetes network access for information about the required configuration in this setup.


The Go collector accepts configuration in two formats: within the application code via an instana.Options configuration object or via environment variables. The in-app configuration takes precedence over environment variables except for the following settings:

  • INSTANA_SERVICE_NAME allows to override the service name set in the code
  • INSTANA_PROCESS_NAME allows to override the name for the infrastructure entity that represents the Go process.
  • INSTANA_DEBUG enables debug logs even if the app code configuration defines a higher logging level
  • INSTANA_AUTO_PROFILE enables continuous profiling with AutoProfile™
  • INSTANA_LOG_LEVEL allows specifying the log level. Possible values are debug, error, warn and info. The INSTANA_DEBUG enviroment variable takes precedence if set
  • INSTANA_KAFKA_HEADER_FORMAT enables users to specify the format of Kafka headers propagated by Instana. Possible values are binary (legacy), string (new format) and both

For more detailed information, refer to the configuration page.

Instana AutoProfile™

Profiles are essential for locating performance hot spots and bottlenecks at the code level. They are instrumental in reducing resource consumption and improving performance.

AutoProfile™ generates and reports process profiles to Instana. Unlike development-time and on-demand profilers, where a user must manually initiate profiling, AutoProfile™ automatically schedules and continuously performs profiling appropriate for critical production environments.

To enable AutoProfile™ add EnableAutoProfile: true option in instana.InitSensor(opt). For detailed instructions, see If you need to enable profiling for an app instrumented with Instana without changing the instana.InitSensor() config, set INSTANA_AUTO_PROFILE=true env variable. Note that this value takes precedence and overrides any attempt to disable profiling from inside the application code.

For more information, see our Instana AutoProfile™ docs.


Outdated Go runtime

Monitoring issue type: outdated_go_runtime

To resolve this issue, update the Go runtime version to the latest one.

See Also