Class EnvironmentGetter
java.lang.Object
io.opentelemetry.api.incubator.propagation.EnvironmentGetter
public final class EnvironmentGetter
extends Object
implements io.opentelemetry.context.propagation.TextMapGetter<Map<String,String>>
A
TextMapGetter that extracts context from a map carrier, intended for use with
environment variables in child processes.
This is useful when a child process needs to extract propagated context from its environment. For example:
Map<String, String> env = System.getenv();
Context context = contextPropagators.getTextMapPropagator()
.extract(Context.current(), env, EnvironmentGetter.getInstance());
This getter automatically sanitizes keys to match environment variable naming conventions:
- Converts keys to uppercase (e.g.,
traceparentbecomesTRACEPARENT) - Replaces
.and-with underscores
Values are validated to contain only characters valid in HTTP header fields per RFC 9110 (visible ASCII
characters, space, and horizontal tab). Values containing invalid characters are treated as
absent and null is returned.
- See Also:
-
Method Details
-
getInstance
Returns the singleton instance ofEnvironmentGetter. -
keys
-
get
-
toString
-