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.attributessystem property:-Dotel.resource.attributes="service.name=myServiceName,service.namespace=myServiceNamespace"Environment Variable: Define the
OTEL_RESOURCE_ATTRIBUTESenvironment 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.namespaceandservice.nameresource attributes directly within theotel-config.yamlfile 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.