OTelEnv class
Utility class for handling OpenTelemetry environment variables.
This class provides methods for reading standard OpenTelemetry environment variables and applying their configuration to the SDK.
OpenTelemetry standard environment variables: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
Constructors
- OTelEnv()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
applyHeaderLogAllowlist(
[Iterable< String> ? headerNames]) → void - Applies the OTLP header log allowlist.
-
getAttributeLimits(
) → AttributeLimitsEnvironmentValues - Get general attribute limits from environment variables.
-
getBlrpConfig(
) → BlrpEnvironmentValues - Get Batch LogRecord Processor (BLRP) configuration from environment variables.
-
getBspConfig(
) → BlrpEnvironmentValues - Get Batch Span Processor (BSP) configuration from environment variables.
-
getExporter(
{String signal = 'traces'}) → String? - Get the selected exporter for a signal.
-
getExporters(
{String signal = 'traces'}) → List< String> ? -
Reads
OTEL_<SIGNAL>_EXPORTERas the spec's comma-separated list (sdk-environment-variables.md, "Exporter Selection": "The implementation MAY accept a comma-separated list to enable setting multiple exporters"). Returns normalized (trimmed, lowercased, deduplicated) names, or null when the variable is unset or empty. -
getLogRecordLimits(
) → AttributeLimitsEnvironmentValues - Get LogRecord attribute limits from environment variables.
-
getMetricsConfig(
) → MetricsEnvironmentValues - Get metrics SDK configuration from environment variables.
-
getOtlpConfig(
{String signal = 'traces'}) → OtlpEnvironmentValues - Get OTLP configuration from environment variables.
-
getPositiveIntEnv(
String name, {required int minInclusive, int? maxInclusive}) → int? - Get a non-negative integer environment variable value.
-
getPropagators(
) → List< String> -
Reads
OTEL_PROPAGATORS(sdk-environment-variables.md, "General SDK Configuration"): a comma-separated list of propagator names. Returns the normalized (trimmed, lowercased) names, defaulting to the spec default[tracecontext, baggage]when unset or empty. -
getResourceAttributes(
) → Map< String, Object> - Get resource attributes from environment variables.
-
getServiceConfig(
) → ServiceEnvironmentValues -
initializeLogging(
) → void - Initialize logging based on environment variables.
-
isSdkDisabled(
) → bool -
Whether
OTEL_SDK_DISABLEDis set to a truthy value. -
parseResourceAttributesString(
String resourceStr) → Map< String, String> - Get service configuration from environment variables.
-
resolveOtlpSecure(
{bool? explicitSecure, bool? envInsecure, String? endpoint, bool fallback = true}) → bool - Resolves whether an OTLP connection should use TLS, per the OTLP exporter spec's precedence: