hs-opentelemetry-api
Copyright(c) Ian Duncan 2024-2026
LicenseBSD-3
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

OpenTelemetry.Environment

Description

Helpers for reading OpenTelemetry environment variables that control exporter selection, metric export intervals, exemplar filters, and log exporter choice. Used by the SDK during provider initialization.

Synopsis

Documentation

readEnv :: Read a => String -> IO (Maybe a) Source #

Read an environment variable and parse it with readMaybe. Returns Nothing if unset or unparseable.

readEnvDefault :: Read a => String -> a -> IO a Source #

Like readEnv but falls back to a default value if the variable is unset or unparseable.

readEnvDefaultWithAlias :: Read a => String -> String -> a -> IO a Source #

Like readEnvDefault but tries a primary key first, then a legacy alias. Useful when an env var was renamed to maintain backwards compatibility.

lookupMetricsExporterSelection :: IO (Maybe MetricsExporterSelection) Source #

Read OTEL_METRICS_EXPORTER. Unknown or empty values return Nothing (caller may default to OTLP).

lookupMetricExportIntervalMillis :: IO (Maybe Int) Source #

Read OTEL_METRIC_EXPORT_INTERVAL (milliseconds between periodic export cycles). See https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/.

lookupMetricExportTimeoutMillis :: IO (Maybe Int) Source #

Read OTEL_METRIC_EXPORT_TIMEOUT (milliseconds allowed per export call). See https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/.

lookupMetricsExemplarFilter :: IO (Maybe MetricsExemplarFilter) Source #

Read OTEL_METRICS_EXEMPLAR_FILTER (first segment if comma-separated). Unknown values return Nothing.

data LogsExporterSelection Source #

Parsed value of OTEL_LOGS_EXPORTER (first entry if comma-separated). See https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#exporter-selection.

Since: 0.4.0.0

Constructors

LogsExporterNone 
LogsExporterOtlp 
LogsExporterConsole 
LogsExporterCustom !String

A name not in the built-in set; looked up via the exporter registry.

lookupLogsExporterSelection :: IO (Maybe LogsExporterSelection) Source #

Read OTEL_LOGS_EXPORTER. Empty values return Nothing (caller defaults to OTLP). Unknown names are returned as LogsExporterCustom for registry lookup.