Splunk Distribution of OpenTelemetry Java Instrumentation

March 5, 2024 ยท View on GitHub

This buildpack framework automatically instruments your Java application with the Splunk distribution of OpenTelemetry Java Instrumentation to send trace data to Splunk Observability Cloud.

Detection Criterion Existence of a bound service containing the string splunk-o11y
Tags splunk-otel-java-agent=<version>

The buildpack detect script prints tags to standard output.

User-Provided Service

Provide your own "user provided service" (cups) instance and bind it to your application.

The service name MUST contain the string splunk-o11y.

For example, to create a service named splunk-o11y that represents Observability Cloud realm us0 and represents a user environment named cf-demo, use the following commands:

$ cf cups splunk-o11y -p \
   '{"splunk.realm": "us0", "splunk.access.token": "<redacted>", "otel.resource.attributes": "deployment.environment=cf-demo"}'
$ cf bind-service myApp splunk-o11y
$ cf restage myApp

Provide the following values using the credential field of the service:

NameRequired?Description
splunk.access.tokenYesSplunk org access token.
splunk.realmYesSplunk realm where data will be sent. This is commonly us0, eu0, and so on. See Available regions or realms for more information.
otel.* or splunk.*OptionalAll additional credentials starting with these prefixes are appended to the application's JVM arguments as system properties.

Choosing a version

To override the default and choose a specific version, use the JBP_CONFIG_* mechanism and set the JBP_CONFIG_SPLUNK_OTEL_JAVA_AGENT environment variable for your application.

For example, to use version 1.16.0 of the Splunk OpenTelemetry Java Instrumentation, run:

$ cf set-env testapp JBP_CONFIG_SPLUNK_OTEL_JAVA_AGENT '{version: 1.16.0}'

In most cases you can use the latest or default version of the agent available.

Additional Resources