| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Telemetry.Internal
Description
The provider construction, the lifecycle bracket and the exporter wrappers behind
Ecluse.Runtime.Telemetry, which documents the substrate 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
- data TelemetrySwitch
- parseTelemetrySwitch :: Text -> Either Text TelemetrySwitch
- data Telemetry
- data TelemetryProviders = TelemetryProviders {}
- telemetryDisabled :: Telemetry
- telemetryEnabled :: OTelSignals -> Telemetry
- telemetryTracerProvider :: Telemetry -> Maybe TracerProvider
- telemetryMeterProvider :: Telemetry -> Maybe MeterProvider
- withTelemetry :: TelemetrySwitch -> LogEnv -> (Telemetry -> IO a) -> IO a
- observeSpanExporter :: ExportFailureSink -> SpanExporter -> SpanExporter
- observeMetricExporter :: ExportFailureSink -> MetricExporter -> MetricExporter
Master switch
data TelemetrySwitch Source #
The ECLUSE_OBSERVABILITY__TELEMETRY master switch. Telemetry is opt-in, so
TelemetryOff is the default.
Constructors
| TelemetryOff | Telemetry is disabled (the default): nothing is wired and nothing is emitted. |
| TelemetryOn | Telemetry is enabled: the SDK providers are built from the standard
|
Instances
| WireVocab TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal | |||||
| Generic TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal Associated Types
Methods from :: TelemetrySwitch -> Rep TelemetrySwitch x # to :: Rep TelemetrySwitch x -> TelemetrySwitch # | |||||
| Show TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal Methods showsPrec :: Int -> TelemetrySwitch -> ShowS # show :: TelemetrySwitch -> String # showList :: [TelemetrySwitch] -> ShowS # | |||||
| Eq TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal Methods (==) :: TelemetrySwitch -> TelemetrySwitch -> Bool # (/=) :: TelemetrySwitch -> TelemetrySwitch -> Bool # | |||||
| Universe TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal Methods universe :: [TelemetrySwitch] # | |||||
| type Rep TelemetrySwitch Source # | |||||
Defined in Ecluse.Runtime.Telemetry.Internal | |||||
parseTelemetrySwitch :: Text -> Either Text TelemetrySwitch Source #
Parse a TelemetrySwitch from its wire name. An unrecognised value fails loudly with the
accepted set, never falling back to a mode.
>>>parseTelemetrySwitch "off"Right TelemetryOff
>>>parseTelemetrySwitch "on"Right TelemetryOn
>>>parseTelemetrySwitch "maybe"Left "unknown telemetry switch \"maybe\" (expected one of: on, off)"
The telemetry handle
The telemetry handle held in the composition root: the off-by-default no-op or the enabled providers. The disabled case carries no provider, so telemetry is inert rather than unsampled.
Constructors
| TelemetryDisabled | The off-by-default no-op: no providers, nothing emitted. |
| TelemetryEnabled TelemetryProviders | The enabled handle carrying the SDK's providers, built from the standard
|
data TelemetryProviders Source #
The SDK providers an enabled Telemetry handle carries: a total product, so its
fields are not partial selectors over the Telemetry sum.
Constructors
| TelemetryProviders | |
Fields
| |
telemetryDisabled :: Telemetry Source #
The disabled telemetry handle: the off-by-default no-op that holds no providers
and emits nothing. This is what an unset ECLUSE_OBSERVABILITY__TELEMETRY resolves to.
telemetryEnabled :: OTelSignals -> Telemetry Source #
Build an enabled telemetry handle from the SDK signals withTelemetry brackets.
telemetryMeterProvider :: Telemetry -> Maybe MeterProvider Source #
The meter provider a Telemetry handle exposes, Nothing when telemetry is
disabled (the dual of telemetryTracerProvider for metric instruments).
Lifecycle
withTelemetry :: TelemetrySwitch -> LogEnv -> (Telemetry -> IO a) -> IO a Source #
Run an action with a Telemetry handle bracketed by the TelemetrySwitch. TelemetryOff
opens nothing. TelemetryOn builds the providers, runs the scrape listener, and tears both down.