Track the memory usage of your Go services and collect metrics instrumented from Go's expvar package.
If you prefer to instrument your Go code using only dogstats-go, you can still use this integration to collect memory-related metrics.
The Go Expvar check is packaged with the Agent, so install the Agent anywhere you run Go services to collect metrics.
If your Go service doesn't use the expvar package already, import it (import "expvar"
). If you don't want to instrument your own metrics with expvar - that is you only want to collect your service's memory metrics - import the package using the blank identifier (import _ "expvar"
). If your service doesn't already listen for HTTP requests (with the http package), make it listen locally just for the Datadog Agent.
To configure this check for an Agent running on a host:
-
Edit the file
go_expvar.d/conf.yaml
, in theconf.d/
folder at the root of your Agent's configuration directory. See the sample go_expvar.d/conf.yaml for all available configuration options.Note: If you don't configure a
metrics
list, the Agent still collects memstat metrics. Usemetrics
to tell the Agent which expvar vars to collect.
Note: The Go Expvar integration can potentially emit custom metrics, which may impact your billing. By default, there is a limit of 350 metrics. If you require additional metrics, contact Datadog support.
For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.
Parameter | Value |
---|---|
<INTEGRATION_NAME> |
go_expvar |
<INIT_CONFIG> |
blank or {} |
<INSTANCE_CONFIG> |
{"expvar_url": "http://%%host%%:8080"} |
Run the Agent's status subcommand and look for go_expvar
under the Checks section.
See metadata.csv for a list of metrics provided by this integration.
The Go-Expvar check does not include any events.
The Go-Expvar check does not include any service checks.
Need help? Contact Datadog support.