ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.Resolve

Description

Resolve the telemetry identity from the environment, collapsing the Datadog and the vanilla OpenTelemetry dialect into one answer that logs and traces share. DD_API_KEY and DD_SITE are never read, and the OTLP endpoint is an operator-declared destination used as given, so no key in the environment can turn into off-cluster egress. OTEL_RESOURCE_ATTRIBUTES is read with the W3C baggage grammar the SDK itself uses, so a percent-encoded value decodes the same way for the dd log object and for the span resource. docs/architecture/observability.md describes the configuration model.

Synopsis

The resolved telemetry identity

data ResolvedTelemetry Source #

The telemetry identity the SDK configuration and the dd log object share. The process cannot know its own deployment environment, so rtEnvironment stays optional.

Constructors

ResolvedTelemetry 

Fields

resolveTelemetry :: [(String, String)] -> ResolvedTelemetry Source #

Resolve the telemetry identity, each field falling __Datadog value, then vanilla OpenTelemetry, then the default__. The resolver never reads DD_API_KEY or DD_SITE.

>>> rtServiceName (resolveTelemetry [("DD_SERVICE", "api"), ("OTEL_SERVICE_NAME", "ignored")])
"api"
>>> teUrl (rtEndpoint (resolveTelemetry []))
"http://localhost:4318"

declaredEnv :: String -> [(String, String)] -> Maybe Text Source #

Read one environment variable, counting a present but blank value as unset.

Boot wiring

prepareTelemetry :: LogEnv -> [(String, String)] -> IO () Source #

Surface the boot warnings and set the canonical OTEL_* environment, before the SDK reads it. A defaulted endpoint is a warning and never a failure: the destination is the operator's to declare.