OpenTelemetry Collector Exporters
OTLP HTTP Exporter
To send metrics over HTTP to Splunk Observability Cloud, we will need to configure the otlphttp exporter.
Let’s edit our /etc/otelcol-contrib/config.yaml
file and configure the otlphttp exporter. Insert the following YAML under the exporters section, taking care to indent by two spaces e.g.
We will also change the verbosity of the logging exporter to prevent the disk from filling up. The default of detailed
is very noisy.
exporters:
logging:
verbosity: normal
otlphttp/splunk:
Next, we need to define the metrics_endpoint
and configure the target URL.
If you are an attendee at a Splunk-hosted workshop, the instance you are using has already been configured with a Realm environment variable. We will reference that environment variable in our configuration file. Otherwise, you will need to create a new environment variable and set the Realm e.g.
export REALM="us1"
The URL to use is https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp
. (Splunk has Realms in key geographical locations around the world for data residency).
The otlphttp exporter can also be configured to send traces and logs by defining a target URL for traces_endpoint
and logs_endpoint
respectively. Configuring these is outside the scope of this workshop.
exporters:
logging:
verbosity: normal
otlphttp/splunk:
metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp
By default, gzip
compression is enabled for all endpoints. This can be disabled by setting compression: none
in the exporter configuration. We will leave compression enabled for this workshop and accept the default as this is the most efficient way to send data.
To send metrics to Splunk Observability Cloud, we need to use an Access Token. This can be done by creating a new token in the Splunk Observability Cloud UI. For more information on how to create a token, see Create a token. The token needs to be of type INGEST.
If you are an attendee at a Splunk-hosted workshop, the instance you are using has already been configured with an Access Token (which has been set as an environment variable). We will reference that environment variable in our configuration file. Otherwise, you will need to create a new token and set it as an environment variable e.g.
export ACCESS_TOKEN=<replace-with-your-token>
The token is defined in the configuration file by inserting X-SF-TOKEN: ${env:ACCESS_TOKEN}
under a headers:
section:
exporters:
logging:
verbosity: normal
otlphttp/splunk:
metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp
headers:
X-SF-TOKEN: ${env:ACCESS_TOKEN}
Configuration Check-in
Now that we’ve covered exporters, let’s check our configuration changes:
Of course, you can easily configure the metrics_endpoint
to point to any other solution that supports the OTLP protocol.
Next, we need to enable the receivers, processors and exporters we have just configured in the service section of the config.yaml
.