ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.Resolve.Internal

Description

The environment reads and the projections behind Ecluse.Runtime.Telemetry.Resolve, which documents the configuration model and re-exports the curated surface. Importing this module opts out of that stability promise, the convention text and bytestring use, so production code imports the public one.

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

data TelemetryEndpoint Source #

A resolved OTLP export endpoint and the source it was resolved from.

Constructors

TelemetryEndpoint 

Fields

data EndpointSource Source #

Where a resolved OTLP endpoint came from, so the boot path can tell a configured target from the silent default.

Constructors

FromDdAgentHost

Derived from DD_AGENT_HOST (as http://{host}:4318).

FromOtelEndpoint

Taken verbatim from OTEL_EXPORTER_OTLP_ENDPOINT.

DefaultedEndpoint

No endpoint was configured, so the http://localhost:4318 default applies.

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.

Canonical OTEL_* projection

otelEnvironmentOverrides :: [(String, String)] -> [(String, String)] Source #

Project the resolved identity back to the canonical OTEL_* variables the env-driven SDK reads. The protocol is pinned to http/protobuf because gRPC sits behind a disabled cabal flag.

data ResourceAttributes Source #

The members the exported header carries, and the keys the W3C baggage limits left out.

Constructors

ResourceAttributes 

Fields

resourceAttributes :: [(String, String)] -> ResourceAttributes Source #

Decide what the exported header carries. The SDK's encoder would shed the overflow in hash order, so the choice is made here: the carried set is stable and every shed key warns at boot.

Boot wiring

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

The boot warnings the environment raises, in the order prepareTelemetry surfaces them.

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.