Documentation forSolarWinds Observability SaaS

Configure the Go Library

See the following sections for information about the configuration options available for the Go Library and how to set them. The service key is the only required configuration; all other configurations are optional.

How to set configuration options

Configuration options can be set in environment variables.

Complete list of configuration options

The following is the complete list of instrumentation configuration options.

Service key

The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when you add the new service.

It is a required configuration and should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

The service name is also called the entity's service ID in SolarWinds Observability SaaS. The service name can also be seen in the Overview tab in the service entity's Entity Explorer details view. Editing the display name of the service entity in SolarWinds Observability SaaS does not affect the Service key.

By default, the service name portion of the service key is used (for example, my-service if the service key is SW_APM_SERVICE_KEY=api-token:my-service). If the OTEL_SERVICE_NAME or OTEL_RESOURCE_ATTRIBUTES environment variable is used to specify a service name, it takes precedence over the default.

System environment variable

SW_APM_SERVICE_KEY

Required

Yes

Default

None

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_SERVICE_KEY="ABC123abcABC123abcABC123abcABC123abcABC123abcABC123abcABC123abcABC123ab:my-service"

Collector

The collector is the ingestion endpoint the library connects to and exports data to. It should be defined using the format host:port. To determine the endpoint for your organization, see Data centers and endpoint URIs. Port is optional and defaults to 443.

System environment variable

SW_APM_COLLECTOR

Required

No

Default

apm.collector.na-01.cloud.solarwinds.com:443

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

  • System environment variable

    export SW_APM_COLLECTOR=YourHost:PortNumber

Host name alias

An optional descriptive host name can be used to easily identify the host. If configured, the host name alias is displayed and can be used as a filter in the Traces Explorer.

System environment variable

SW_APM_HOSTNAME_ALIAS

Required

No

Default

None

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_HOSTNAME_ALIAS=apm-host-east

Trigger tracing mode

This enables or disables trigger tracing for the service. Setting it to disabled turns off support for trigger trace, which might affect DEM visibility into the service.

System environment variable

SW_APM_TRIGGER_TRACE

Required

No

Default

enabled

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Trusted certificate path

The library uses the trusted CA certificates configured for the underlying native extension library to verify the TLS connection to the collector. To override the default, define the trusted certificate path configuration option with an absolute path to a specific trusted certificate file in PEM format.

System environment variable

SW_APM_TRUSTEDPATH

Required

No

Default

None

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_TRUSTEDPATH=/path/to/cacert.crt

Logging level

The Go library’s logging verbosity can be adjusted by setting the logging level.

System environment variable

SW_APM_DEBUG_LEVEL

Valid Values

DEBUG, INFO, WARN, ERROR

Required

No

Default

ERROR

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_DEBUG_LEVEL=DEBUG

EC2 Metadata Timeout

The Go Library is able to detect if it is running on an AWS EC2 or OpenStack instance by querying Instance Metadata. The timeout (in milliseconds) for retrieving the metadata can be set through this configuration. It is safe to set this value to 0 for apps that do not run on EC2 or OpenStack.

System environment variable

SW_APM_EC2_METADATA_TIMEOUT

Valid values

This field expects an integer between 0 and 3000

Required

No

Default

1000

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_EC2_METADATA_TIMEOUT=500

Use HTTP proxy

The Go Library can connect to the SolarWinds APM collector through a proxy. The config value should be either <scheme>://<proxyHost>:<proxyPort> for a proxy server that does not require authentication, or <scheme>://<username>:<password>@<proxyHost>:<proxyPort> for a proxy server that requires Basic authentication. The scheme can be http or https and determines only the library-to-proxy connection type. The proxied connection to the collector is always secured with TLS. An https scheme can optionally set SW_APM_PROXY_CERT_PATH to specify the trusted certificate used to verify the connection to the proxy server.

Proxying only applies to the gRPC connection between the library and the collector. When the library makes direct HTTP requests to retrieve EC2 instance metadata, all proxy settings are bypassed.

SolarWinds recommends using the Go Library-specific configuration. However, if a Go Library-specific configuration is not set, its underlying network library uses a system-wide proxy defined in the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY. Refer to gRPC library for more information.

System environment variable

SW_APM_PROXY

SW_APM_PROXY_CERT_PATH (optional and used only when the proxy scheme is https)

Valid Values

String in the format <scheme>://<proxyHost>:<proxyPort> or <scheme>://<username>:<password>@<proxyHost>:<proxyPort>

This field is case-sensitive.

Required

No

Default

None

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Examples

export SW_APM_PROXY="http://my-proxy:3306"
export SW_APM_PROXY_CERT_PATH="/path/to/trustedcert.pem"

Tracing mode

Tracing can be disabled for the service. When disabled, requests are no longer monitored, and traces and metrics are not sent. The trace context is still injected in the HTTP request and response headers.

System environment variable

SW_APM_TRACING_MODE

Required

No

Possible values

disabled Does not continue existing traces or start new ones, and does not report metrics for requests.
enabled (Default) Create or continue traces (subject to sampling and rate limits), and always report metrics for requests.

Default

enabled

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_TRACING_MODE=disabled

Transaction naming

The Go Library provides the option to assign a custom transaction name to all traces. This can be used to, for example, target specific instrumented lambda functions. To configure a name, set the SW_APM_TRANSACTION_NAME environment variable as described below.

Configuration of a custom transaction name is superseded by any use of the SDK to SetTransactionName, described in Go Library instrumentation SDK.

System environment variable

SW_APM_TRANSACTION_NAME

Valid values

Any string representing a valid transaction name.

This field is case-sensitive.

Required

No

Default

None

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_TRANSACTION_NAME=my-cool-request

Disable the library

The Go Library provides the option to completely disable the instrumentation without explicitly removing the library from your application. To disable the library, set the SW_APM_ENABLED environment variable as described below.

System environment variable

SW_APM_ENABLED

Valid values

This field is case-insensitive.

false

Do not instrument the application (that is, do not generate any trace data)

true Normal tracing operation

Required

No

Default

true

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_AGENT_ENABLED=false

Runtime metrics

The Go Library by default collects Go runtime metrics. This configuration option can be used to disable the feature.

System environment variable

SW_APM_RUNTIME_METRICS

Valid values

true, false

Required

No

Default

true

History

Introduced with version 1.0.0 of the Go Instrumentation Library.

Example

export SW_APM_RUNTIME_METRICS=false

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.