Recommended OpenTelemetry Resource Attributes
OpenTelemetry resource attributes are added to log, span, and metrics emitted by your application.
These service resource attributes allow you to filter your metrics and traces effectively:
|service.namespace||An optional namespace for |
|service.name||The application name|
|deployment.environment||Name of the deployment environment (|
|service.instance.id||The unique instance, e.g. the pod name|
|service.version||The application version, to see if a new version has introduced a bug|
OpenTelemetry logs and metrics are stored in Loki and Prometheus respectively.
Both Loki and Prometheus use
instance labels according the OpenTelemetry compatibility specification with Prometheus and OpenMetrics:
|Label||Filled with attribute (if it is found)|
Java Resource Providers
When using the Java Agent or Grafana OpenTelemetry Starter1, a set of global attributes, also known as resource attributes, is added to each span, metric, and log entry. The attributes are managed via Resource Providers which are detailed here. You can enable/disable select providers using the following properties or environment variable.
|System Property /|
|Enables one or more ResourceProvider types. If unset, all resource providers are enabled and all associated attributes are sent.|
|Disables one or more ResourceProvider types.|
As an example, if you don’t want to expose the name of the operating system through the resource, you can pass the following system property on the command line to disable the OsResourceProvider:
java -Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.resources.OsResourceProvider -jar app.jar
Or if you only want to see process resources such as PID, you could export the following environment variable to enable only the ProcessResourceProvdier:
You can set multiple resource providers by separating them with a comma (
To use the disable/enable properties with
grafana-opentelemetry-starter:1.0.0you will need to include
io.opentelemetry.instrumentation:opentelemetry-resources:<otelVersion>-alphaas a runtime dependency. With later versions, you can simply set/export the property/variable. ↩︎