Go Collector Configuration

For most use cases it is sufficient to just initialize the Instana Go collector with instana.NewSensor() and leave the default configuration options in place. You can also pass in a configuration object when initializing the Instana Go collector:

sensor := instana.NewSensorWithTracer(
	instana.NewTracerWithOptions(&instana.Options{
		// ...
	},
)

The instana.Options configuration object provides following fields to configure the collector:

  • Service - global service name that will be used to identify the program in the Instana backend
  • AgentHost, AgentPort - default to localhost:42699, set the coordinates of the Instana proxy agent
  • LogLevel - one of Error, Warn, Info or Debug
  • EnableAutoProfile - enables automatic continuous process profiling when true
  • MaxBufferedSpans - the maximum number of spans to buffer
  • ForceTransmissionStartingAt - the number of spans to collect before flushing the buffer to the agent
  • MaxBufferedProfiles - the maximum number of profiles to buffer
  • IncludeProfilerFrames - whether to include profiler calls into the profile or not
  • Tracer - tracer-specific configuration used by all tracer instances

Most of these values can be also be set via the environment variables. The in-app configuration takes precedence over environment variables except for 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ā„¢

Running in serverless environment

To use Instana Go Collector for monitoring a service running in a serverless environment, such as AWS Fargate or Google Cloud Run, make sure that you have INSTANA_ENDPOINT_URL and INSTANA_AGENT_KEY env variables set in your task definition. Note that the INSTANA_AGENT_HOST and INSTANA_AGENT_PORT env variables will be ignored in this case. Refer to the respective section of Instana documentation for detailed explanation on how to do this:

Services running in serverless environments don't use host agent to send metrics and trace data to Instana backend, therefore the usual way of configuring the in-app sensor via configuration.yaml file is not applicable. Instead, there is a set of environment variables that can optionally be configured in service task definition:

  • INSTANA_TIMEOUT
  • INSTANA_SECRETS
  • INSTANA_EXTRA_HTTP_HEADERS
  • INSTANA_ENDPOINT_PROXY
  • INSTANA_TAGS
  • INSTANA_ZONE

Refer to the Serverless Monitoring section for more detailed description of these variables and their value format.

Kafka Trace Correlation Headers

You can configure the format for Kafka trace correlation headers that are used by the Go tracer with the environment variable INSTANA_KAFKA_HEADER_FORMAT. Valid values are binary, string, or both.

Another alternative is to configure the Kafka trace correlation header format at the level of the Instana host agent.

For more information, see Kafka Header Migration.