
What is a Resource?
A Resource is a set of key/value attributes that identify the source of telemetry. Common resource attributes include service name, host/hostname, container name or ID, cloud provider, region, and deployment environment (prod/staging).
Why Resources Matter
Resources let you identify the producing entity for telemetry so you can ask operational questions such as:- Was this error coming from
service Bon AWS? - Is the latency isolated to the Kubernetes namespace
payments? - Which team owns the service that emitted this span?

service.name = "payment-service"pod.name = "payment-api"cloud.provider = "aws"
Default Resource Attributes
OpenTelemetry SDKs provide default resource attributes you should know:service.name(defaults tounknown_serviceif not set)telemetry.sdk.nametelemetry.sdk.languagetelemetry.sdk.version

| Attribute Key | Typical Value | Purpose |
|---|---|---|
service.name | payment-service | Identifies the service producing telemetry |
telemetry.sdk.language | python | Runtime/language of the SDK |
telemetry.sdk.version | 1.0.0 | SDK version for debugging and compatibility |
If you don’t set
service.name, it will default to unknown_service. With many services emitting telemetry, this makes it hard to identify which trace belongs to which service—so it is a best practice to set service.name for every instrumented app.Automatic Resource Detection
OpenTelemetry supports automatic resource detection via detectors. Detectors gather environment metadata and populate resource attributes without manual configuration. Typical detectors can collect:- OS type and description
- Hostname and architecture
- Process details
- Container name/ID
- Kubernetes pod and namespace
- Cloud provider and region

Benefits of Resource Attributes
Adding resource attributes makes it easier to:- Group and filter telemetry by service, pod, container, or host
- Troubleshoot incidents by narrowing scope quickly
- Correlate telemetry across services and environments
- Support multi-cloud and multi-environment setups

Custom Resource Attributes
You can add custom resource attributes for business or operational metadata, for example the team owning a service, application grouping, or feature flags. These attributes complement auto-detected attributes and improve searchability and access control in observability backends.
Resource to the TracerProvider during initialization. The following Python example shows creating a custom resource and configuring a tracer provider so every span includes those attributes:

Configure Resources via Environment Variables
In many deployments, especially with automatic instrumentation, configuring resources using environment variables is easier because it requires no code changes and works across CI/CD and orchestration tooling. Example (bash):
Common Use Cases
- Configure attributes from CI/CD or infrastructure without modifying code.
- Filter and group telemetry in the backend (for example, show only traces from
production). - Facilitate cross-service tracing by consistently tagging spans.
- Support multi-cloud or multi-environment setups by tagging
cloud.providerorregion.
Summary
- A Resource in OpenTelemetry defines the origin of telemetry data (service, host, container, environment).
- Configure the resource once during SDK initialization; it is automatically applied to all spans, metrics, and logs produced by that SDK instance.
- Default attributes include
service.name(defaults tounknown_service),telemetry.sdk.name,telemetry.sdk.language, andtelemetry.sdk.version. - Resource detectors can automatically collect metadata (host, process, container, Kubernetes, cloud provider).
- You can add additional attributes manually via
Resource.create(...)in code or via theOTEL_RESOURCE_ATTRIBUTESenvironment variable. - Follow semantic conventions for attribute names to ensure consistency across telemetry.

For consistent and searchable telemetry, set
service.name and other domain-specific attributes using OpenTelemetry semantic conventions. Prefer environment variables for deployment-wide defaults and let resource detectors populate infrastructure-level attributes automatically.- OpenTelemetry: https://opentelemetry.io/
- Semantic Conventions for Resources: https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/