Configure the Ruby agent for Splunk Observability Cloud 🔗
You can configure the Ruby agent from the Splunk Distribution of OpenTelemetry Ruby to suit your instrumentation needs. In most cases, modifying the basic configuration is enough to get started.
The following sections describe all available settings for configuring the Ruby agent, including options for activating new features that are unique to the Splunk Distribution of OpenTelemetry Ruby.
General settings 🔗
The following settings are specific to the Splunk Distribution of OpenTelemetry Ruby:
Environment variable |
Description |
---|---|
|
A Splunk authentication token that lets exporters send data directly to Splunk Observability Cloud. Unset by default. Not required unless you need to send data to the Splunk Observability Cloud ingest endpoint. See Create and manage authentication tokens using Splunk Observability Cloud. |
|
The name of your organization’s realm, for example, |
|
Lets you add server trace information to HTTP response headers using the |
To send data directly to Splunk Observability Cloud, see Send data directly to Splunk Observability Cloud.
Trace configuration 🔗
The following settings control tracing limits and attributes:
Environment variable |
Description |
---|---|
|
Name of the service or application you’re instrumenting. Takes precedence over the service name defined in the |
|
Comma-separated list of resource attributes added to every reported span. For example, |
|
Maximum number of attributes per span. The default value is unlimited. |
|
Maximum number of attributes per event. The default value is unlimited. |
|
Maximum number of attributes per link. The default value is unlimited. |
|
Maximum number of events per span. The default value is unlimited. |
|
Maximum number of links per span. The default value is |
|
Maximum length of strings for attribute values. Values larger than the limit are truncated. The default value is |
Exporters configuration 🔗
The following settings control trace exporters and their endpoints:
Environment variable |
Description |
---|---|
|
Trace exporter to use. You can set multiple comma-separated values (for example, |
|
The OTLP endpoint. The default value is |
The Splunk Distribution of OpenTelemetry Ruby uses the OTLP gRPC span exporter by default.
Propagators configuration 🔗
The following settings control trace propagation:
Environment variable |
Description |
---|---|
|
Comma-separated list of propagators you want to use. The default value is |
For backward compatibility with the SignalFx Ruby Tracing Library, use the b3multi trace propagator:
export OTEL_PROPAGATORS=b3multi
$env:OTEL_PROPAGATORS=b3multi
Server trace information 🔗
To connect Real User Monitoring (RUM) requests from mobile and web applications with server trace data, activate the Rack instrumentation in the configuration:
Splunk::Otel.configure do |c|
c.use "OpenTelemetry::Instrumentation::Rack"
end
# Add the middleware in Rack::Builder
Rack::Builder.app do
use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
use Splunk::Otel::Rack::RumMiddleware
run ->(_env) { [200, { "content-type" => "text/plain" }, ["OK"]] }
end
When using ActionPack, the middleware is added automatically if the instrumentation ActionPack is activated:
# Rails use ActionPack
Splunk::Otel.configure do |c|
c.use "OpenTelemetry::Instrumentation::ActionPack"
c.use "Splunk::Otel::Instrumentation::ActionPack"
end
After you’ve activated the Rack instrumentation, set the following environment variable:
export SPLUNK_TRACE_RESPONSE_HEADER_ENABLED=true
$env:SPLUNK_TRACE_RESPONSE_HEADER_ENABLED=true
When you set this environment variable, the instrumentation adds the following response headers to HTTP responses:
Access-Control-Expose-Headers: Server-Timing
Server-Timing: traceparent;desc="00-<serverTraceId>-<serverSpanId>-01"
The Server-Timing
header contains the traceId
and spanId
in traceparent
format. For more information, see the Server-Timing and traceparent documentation on the W3C website.