Ask Miss O11y: Making Sense of OpenTelemetry: Who’s There? The Resource.
Blog post from Honeycomb
Incorporating instrumentation code into an application involves creating a Resource object, which is crucial when setting up the OpenTelemetry SDK for tracing, as it specifies the program sending spans and its execution environment. The Resource object is a key-value store that can hold attributes like service name, instance ID, and version, which are important for identifying the origin of telemetry data. If omitted, the SDK defaults the service name to "unknown_service" with a language suffix. The OpenTelemetry Protocol (OTLP) groups all spans by a single Resource, ensuring that attributes are expanded to every span emitted by the program. Although OpenTelemetry standardizes these attributes for compatibility across telemetry streams, users can bypass creating a Resource by defining the OTEL_SERVICE_NAME environment variable, simplifying the process. The concept of a Resource, originally from the metrics domain, emphasizes the compatibility and standardization that OpenTelemetry strives for between metrics and traces, despite the complexity it introduces in terms of imports and setup.