Docs » Instrument serverless functions for Splunk Observability Cloud » Instrument AWS Lambda functions for Splunk Observability Cloud » Send serverless spans through the Splunk OpenTelemetry Collector

Send serverless spans through the Splunk OpenTelemetry Collector 🔗

By default, the Splunk OpenTelemetry Lambda Layer sends telemetry to Splunk Observability Cloud endpoints, without using a Collector. Though not required, deploying a Splunk OTel Collector in the same virtual private cloud (VPC) of your Lambda can reduce latency in some cases.

To send spans to the Splunk OTel Collector from an AWS Lambda function instrumented using the Splunk Lambda layer, follow these steps:

  1. Deploy the Collector in Gateway mode in a service your Lambda can reach, for example EC2. See Gateway mode.

  2. Install the Splunk OTel Lambda layer. See Instrument your AWS Lambda function for Splunk Observability Cloud.

  3. Navigate to Configuration > Environment variables, then select Edit.

  4. As you’re sending telemetry to the Collector, delete the SPLUNK_REALM environment variable.

  5. If you’ve already set the access token in the Collector configuration, delete the SPLUNK_ACCESS_TOKEN environment variable.

  6. Add the following environment variables:

    • OTEL_TRACES_EXPORTER with the value otlp_proto_http

    • OTEL_EXPORTER_OTLP_ENDPOINT with the value <collector-gateway-ip-or-dns-name>:4318