Configuring OpenTelemetry
To configure OpenTelemetry resource attributes, specifically service.namespace
and service.name
, follow one of the methods below. These attributes are crucial for identifying your services within OpenTelemetry.
System Property: When launching your application, set the
otel.resource.attributes
system property:-Dotel.resource.attributes="service.name=myServiceName,service.namespace=myServiceNamespace"
Environment Variable: Define the
OTEL_RESOURCE_ATTRIBUTES
environment variable in your environment:export OTEL_RESOURCE_ATTRIBUTES="service.name=myServiceName,service.namespace=myServiceNamespace"
OpenTelemetry Collector Configuration: If you are utilizing an OpenTelemetry Collector, you can specify the
service.namespace
andservice.name
resource attributes directly within theotel-config.yaml
file used by the collector. In most cases, you should set up and run an OpenTelemetry Collector on the same system that hosts the Java Agent.