Monitoring Go
Monitor your Go applications by installing the Instana Go Collector (also referred to as Go Tracer or in process collector) after setting up the Instana host agent.
For more information, see Instana host agent.
The Go Collector provides instrumentation for supported technologies, zero configuration health monitoring of Go services, and end-to-end traces of requests across all systems. You can view the collected metrics and traces in the Instana UI.
Support information
To make sure the Go Collector is compatible with your current setup, check the following support information sections:
Supported runtimes
Go Collector v1.70 or later supports Go 1.24 and 1.25, and maintains compatibility with Go 1.23 (EOL).
Make sure to always use the latest version of the tracer, as it provides new features, improvements, security updates and fixes.
Supported processor architectures and operating systems
The Go collector is compatible with and officially supported on the following environments:
| Architecture | Operating systems | Remarks |
|---|---|---|
| x86_64 (AMD64) | Linux, Windows, and macOS | |
| AArch64 (ARM64) | Linux, Windows, and macOS | |
| IBM Power (ppc64) | AIX | Due to limited CGO support on AIX, libraries that depend on CGO are not compatible. |
| IBM Power (ppc64le) | pLinux (Linux on Power) | |
| IBM Z (s390x) | LinuxONE (Linux on IBM Z), z/OS | Due to limited CGO support on z/OS, libraries that depend on CGO are not compatible. |
Supported frameworks and libraries
To avoid adding unnecessary dependencies, Instana main github.com/instana/go-sensor 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 github.com/instana/go-sensor/instrumentation/... and need to be added
to go.mod separately.
Trace continuity is not applicable to database and logging libraries.
HTTP
The following table outlines the HTTP libraries that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version | Trace continuity |
|---|---|---|---|---|---|
net/http |
0 day | github.com/instana/go-sensor |
1.70.0 | ✅ | |
github.com/labstack/echo |
45 days | 4.13.4 | github.com/instana/go-sensor/instrumentation/instaecho |
1.37.0 | ✅ |
github.com/gin-gonic/gin |
45 days | 1.10.1 | github.com/instana/go-sensor/instrumentation/instagin |
1.35.0 | ✅ |
github.com/gorilla/mux |
45 days | 1.8.1 | github.com/instana/go-sensor/instrumentation/instamux |
1.34.0 | ✅ |
github.com/julienschmidt/httprouter |
45 days | 1.3.0 | github.com/instana/go-sensor/instrumentation/instahttprouter |
1.32.0 | ✅ |
github.com/gofiber/fiber |
45 days | 2.52.9 | github.com/instana/go-sensor/instrumentation/instafiber |
0.30.0 | ✅ |
github.com/beego/beego |
45 days | 2.3.8 | github.com/instana/go-sensor/instrumentation/instabeego |
0.27.0 | ✅ |
github.com/valyala/fasthttp |
45 days | 1.66.0 | github.com/instana/go-sensor/instrumentation/instafasthttp |
0.23.0 | ✅ |
RPC
The following table outlines the RPC library that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version | Trace continuity |
|---|---|---|---|---|---|
google.golang.org/grpc |
45 days | 1.75.2 | github.com/instana/go-sensor/instrumentation/instagrpc |
1.50.2 | ✅ |
Databases
The following table outlines the database libraries that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version |
|---|---|---|---|---|
database/sql |
0 day | github.com/instana/go-sensor |
1.70.0 | |
go.mongodb.org/mongo-driver |
45 days | 2.3.0 | github.com/instana/go-sensor/instrumentation/instamongo |
2.11.0 |
jackc/pgx |
45 days | 5.7.6 | github.com/instana/go-sensor/instrumentation/instapgx |
2.19.1 |
go-redis |
45 days | 9.14.0 | github.com/instana/go-sensor/instrumentation/instaredis |
2.36.0 |
redigo |
45 days | 1.9.2 | github.com/instana/go-sensor/instrumentation/instaredigo |
0.34.0 |
gorm |
45 days | 1.30.5 | github.com/instana/go-sensor/instrumentation/instagorm |
1.32.0 |
gocb |
45 days | 2.11.0 | github.com/instana/go-sensor/instrumentation/instagocb |
1.26.0 |
azcosmos |
45 days | 1.4.1 | github.com/instana/go-sensor/instrumentation/instacosmos |
1.22.1 |
Messaging
The following table outlines the messaging libraries that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version | Trace continuity |
|---|---|---|---|---|---|
cloud.google.com/go/pubsub |
45 days | 1.50.1 | github.com/instana/go-sensor/instrumentation/cloud.google.com/go/pubsub |
1.74.2 | ✅ |
github.com/IBM/sarama |
45 days | 1.46.0 | github.com/instana/go-sensor/instrumentation/instasarama |
1.44.0 | ✅ |
github.com/rabbitmq/amqp091-go |
45 days | 1.10.0 | github.com/instana/go-sensor/instrumentation/instaamqp091 |
0.33.0 | ✅ |
GraphQL
The following table outlines the GraphQL libraries that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version | Trace continuity |
|---|---|---|---|---|---|
graphql-go/graphql |
45 days | 0.8.1 | github.com/instana/go-sensor/instrumentation/instagraphql |
1.29.0 | ❌ |
Other
The following table outlines other libraries that the Go Collector supports for tracing:
| Target library | Support policy | Version | Instrumentation package | Version | Trace continuity |
|---|---|---|---|---|---|
cloud.google.com/go/storage |
45 days | 1.56.1 | github.com/instana/go-sensor/instrumentation/cloud.google.com/go/storage |
1.74.2 | ❌ |
github.com/aws/aws-sdk-go |
45 days | 1.55.8 | github.com/instana/go-sensor/instrumentation/instaawssdk |
1.46.0 | ✅ |
github.com/aws/aws-lambda-go |
45 days | 1.49.0 | github.com/instana/go-sensor/instrumentation/instalambda |
1.42.0 | ✅ |
github.com/sirupsen/logrus |
45 days | 1.9.3 | github.com/instana/go-sensor/instrumentation/instalogrus |
1.34.0 | ❌ |
github.com/aws/aws-sdk-go-v2 |
45 days | 1.39.0 | github.com/instana/go-sensor/instrumentation/instaawsv2 |
0.40.0 | ✅ |
Runtime Metrics
The following metrics are collected and displayed on the Go process dashboard:
- Memory usage
- Heap usage
- GC activity
- Goroutines
Health Signatures
The following key indicators determine the health of Go applications:
- Calls
- Response time
- Scaling
Installation
The installation of the Instana Go collector is a simple two-step process. First, add github.com/instana/go-sensor module to your go.mod file:
go get github.com/instana/go-sensor
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.
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))
instana.SetLogger(l)
// ...
l.SetLevel(logger.WarnLevel)
The logger.LeveledLogger interface is implemented by such popular logging libraries as github.com/sirupsen/logrus and go.uber.org/zap,
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 "github.com/instana/go-sensor"
"github.com/sirupsen/logrus"
)
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
instana.SetLogger(logger)
// ...
}
Platforms
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. Refer to the Serverless Monitoring section to learn about other configuration options available in serverless mode.
Generic serverless agent
To monitor Go applications in a serverless environment, such as AWS Lambda, or on a server without a host agent, instrument the application with the Instana Go Tracer SDK, deploy it, and set the INSTANA_ENDPOINT_URL and INSTANA_AGENT_KEY environment variables.
In this generic serverless agent setup, only traces are available, and not metrics. However, for specific serverless services, such as AWS Lambda or Fargate, Instana also collects metrics and correlates infrastructure.
For more information about particular serverless services, see the following list.
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 github.com/instana/go-sensor/instrumentation/instalambda 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 github.com/instana/go-sensor/instrumentation/instaazurefunction package to collect and send trace data. For more information, see Azure Functions Tracing for Go.
Azure Container Apps
The Instana Go Collector supports tracing of Go applications that are deployed in Azure Container Apps. To enable tracing, instrument your application with the Instana Go Tracer SDK, deploy it to Azure Container Apps, and ensure that the required environment variables are set. For more information, see Monitoring Azure Container Apps.
Kubernetes and 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.
Configuration
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_NAMEallows to override the service name set in the codeINSTANA_PROCESS_NAMEallows to override the name for the infrastructure entity that represents the Go process.INSTANA_DEBUGenables debug logs even if the app code configuration defines a higher logging levelINSTANA_AUTO_PROFILEenables continuous profiling with AutoProfile™INSTANA_LOG_LEVELallows specifying the log level. Possible values aredebug,error,warnandinfo. TheINSTANA_DEBUGenviroment variable takes precedence if setINSTANA_KAFKA_HEADER_FORMATenables users to specify the format of Kafka headers propagated by Instana. Possible values arebinary(legacy),string(new format) andbothINSTANA_ALLOW_ROOT_EXIT_SPANdetermines whether the tracer starts a trace with an exit span or not. If you set the value to1, the tracer records exit spans for the outgoing calls in instances with no parent entry span. If you set0orany other value, the tracer does not start a trace with an exit span.
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 github.com/instana/go-sensor. 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.
Troubleshooting
You might encounter the following issue while monitoring the Go applications:
Outdated Go runtime
Monitoring issue type: outdated_go_runtime
To resolve this issue, update the Go runtime version to the latest one.