Flow PHP

EnvironmentDetector implements ResourceDetector

Read onlyYes
FinalYes

Detects resource attributes from environment variables.

Reads the following OpenTelemetry standard environment variables:

  • OTEL_SERVICE_NAME: Sets service.name attribute
  • OTEL_RESOURCE_ATTRIBUTES: Sets additional attributes in key=value,key2=value2 format

Attributes from OTEL_RESOURCE_ATTRIBUTES follow the format specified by OpenTelemetry:

OTEL_RESOURCE_ATTRIBUTES=key1=value1,key2=value2

Special characters in values can be escaped with backslash:

OTEL_RESOURCE_ATTRIBUTES=key=value\,with\,commas

OTEL_SERVICE_NAME takes precedence over service.name in OTEL_RESOURCE_ATTRIBUTES.

Example:

export OTEL_SERVICE_NAME=my-service
export OTEL_RESOURCE_ATTRIBUTES=service.version=1.0.0,deployment.environment.name=production

Interfaces

ResourceDetector
Interface for detecting resource attributes from the environment.

Methods

detect()  : Resource
Detect resource attributes from the environment.

Methods


        
On this page

Search results