The official Splunk documentation for this page is Configure the Splunk Distribution of OTel JS. For instructions on how to contribute to the docs, see CONTRIBUTING.md.
To configure the Splunk Distribution of OpenTelemetry JS, you can use a combination of environment variables and arguments passed to the startTracing()
function:
-
Environment variables
For example:
export OTEL_SERVICE_NAME='test-service'
-
Arguments passed to the
startTracing()
functionFor example:
startTracing({ serviceName: 'my-node-service', });
startTracing()
arguments take precedence over the corresponding environment variables.
This distribution supports all the configuration options supported by the components it uses with the defaults specified by the OTel Specification.
Environment variablestartTracing() argument |
Default value | Support | Notes |
---|---|---|---|
OTEL_ATTRIBUTE_COUNT_LIMIT |
Stable | Maximum allowed span attribute count | |
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT |
12000 * |
Stable | Maximum allowed attribute value size |
OTEL_EXPORTER_JAEGER_ENDPOINT |
http://localhost:14268/v1/traces orhttp://localhost:9080/v1/trace if jaeger-thrift-splunk is used as exporter |
Stable | HTTP endpoint for Jaeger traces |
OTEL_EXPORTER_OTLP_ENDPOINT endpoint |
localhost:4317 |
Stable | The OTLP endpoint to export to. Only OTLP over gRPC is supported. |
OTEL_LOG_LEVEL |
Stable | Log level to use in diagnostics logging. Does not set the logger. | |
OTEL_PROPAGATORS propagators |
tracecontext,baggage |
Stable | Comma-delimited list of propagators to use. Valid keys: baggage , tracecontext , b3multi , b3 . |
OTEL_RESOURCE_ATTRIBUTES |
Stable | Comma-separated list of resource attributes added to every reported span. Examplekey1=val1,key2=val2 |
|
OTEL_SERVICE_NAME serviceName |
unnamed-node-service |
Stable | The service name of this Node service. |
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT |
128 |
Stable | Maximum allowed span attribute count |
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT |
Stable | Maximum allowed attribute value size. Empty value is treated as infinity | |
OTEL_SPAN_EVENT_COUNT_LIMIT |
128 |
Stable | |
OTEL_SPAN_LINK_COUNT_LIMIT |
1000 * |
Stable | |
OTEL_TRACES_EXPORTER tracesExporter |
otlp |
Stable | Chooses the exporter. Shortcut for setting spanExporterFactory . One of [otlp , jaeger-thrift-http , jaeger-thrift-splunk ]. See TracesExporter . |
OTEL_TRACES_SAMPLER |
parentbased_always_on |
Stable | Sampler to be used for traces. See Sampling |
OTEL_TRACES_SAMPLER_ARG |
Stable | String value to be used as the sampler argument. Only be used if OTEL_TRACES_SAMPLER is set. | |
SPLUNK_ACCESS_TOKEN accessToken |
Stable | The optional access token for exporting signal data directly to SignalFx API. | |
SPLUNK_TRACE_RESPONSE_HEADER_ENABLED serverTimingEnabled |
true |
Stable | Enable injection of Server-Timing header to HTTP responses. |
The following config options can be set by passing them as arguments to startTracing()
.
-
tracerConfig
: A JS object that is merged into the default tracer config replacing any existing keys. It's passed to the tracer provider during initialization. This can be used to customize the tracer provider or tracer. Must satisfyTracerConfig
interface -
spanExporterFactory
: A function that accepts the options passed to the startTracing function. Returns a new instance of SpanExporter. When set, this function is used to create a new exporter and the returned exporter will be used in the pipeline. -
spanProcessorFactory
: Returns a SpanProcessor instance or an array of SpanProcessor instances. When set, this function is be used to create one or more span processors. The returned processors are added to the global tracer provider and configured to process all spans generated by any tracer provider by the global provider. The function creates a new span exporter and uses it with each processor it creates. It may calloptions.spanExporterFactory(options)
to create a new exporter as configured by the user. -
propagatorFactory
: A function that returns a new instance of a TextMapPropagator. Defaults to a composite propagator comprised of W3C Trace Context and Baggage propagators. -
instrumentations
: Can be used to enable additional instrumentation packages. -
captureHttpRequestUriParams
: Either a list of keys (case-sensitive) of HTTP query parameters to capture or a function that gets invoked with the current span and query parameters to set a custom span attribute. When using the former, parameters are set as span attributes ashttp.request.param.${key}
. Attribute keys are normalized at capture time, meaning.
is replaced with_
to avoid any attribute namespacing issues.
Environment variablestartMetrics() argument |
Default value | Support | Notes |
---|---|---|---|
SPLUNK_METRICS_ENABLED enabled |
false |
Experimental | Enabled metrics export. See metrics documentation for more information. |
SPLUNK_METRICS_ENDPOINT endpoint |
http://localhost:9943 |
Experimental | The metrics endpoint to send to. |
SPLUNK_METRICS_EXPORT_INTERVAL exportInterval |
5000 |
Experimental | The interval, in milliseconds, of metrics collection and exporting. |
-
signalfx
: A JS object with optionalclient
anddimensions
fields. If you have already setup a SignalFx client with custom configuration, you can use this for sending instead of creating, configuring a new one.dimensions
object adds a pre-defined dimension for each datapoint. The format fordimensions
is{key: value, ...}
.The following is a list of dimensions added by default:
service
: seeserviceName
from the tracing sectionmetric_source
:splunk-otel-js
node_version
:process.versions.node
, e.g.16.10.0
*: Overwritten default value