logo
Expand description

Resource

A Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace, and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the Resource.

The primary purpose of resources as a first-class concept in the SDK is decoupling of discovery of resource information from exporters. This allows for independent development and easy customization for users that need to integrate with closed source environments. When used with distributed tracing, a resource can be associated with the TracerProvider when it is created. That association cannot be changed later. When associated with a TracerProvider, all Spans produced by any Tracer from the provider are associated with this Resource.

Resource detectors

ResourceDetectors are used to detect resource from runtime or environmental variables. The following ResourceDetectors are provided along with this SDK.

  • EnvResourceDetector, detect resource from environmental variables.
  • OsResourceDetector, detect OS from runtime.
  • ProcessResourceDetector, detect process information

Structs

Resource detector implements ResourceDetector and is used to extract general SDK configuration from environment.

An owned iterator over the entries of a Resource.

An iterator over the entries of a Resource.

Detect runtime operating system information.

Detect process information.

Describes an entity about which identifying information and metadata is exposed.

There are the attributes which MUST be provided by the SDK as specified in the Resource SDK specification. This detector detect those attributes and if the attribute cannot be detected, use the default value.

Traits

ResourceDetector detects OpenTelemetry resource information