ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.Instruments

Description

The live OpenTelemetry instruments over the pure ecluse.* catalogue (Ecluse.Core.Telemetry.Metrics), and one typed record* per signal. Each helper takes only the bounded label values its metric carries, so the type enforces the cardinality rule at the call site. With telemetry off, newMetrics builds from the SDK's no-op meter provider, so the hot path records unconditionally: no per-call branch, and the metricAttributes a call passes is never forced. docs/architecture/observability.md describes the catalogue.

Synopsis

The instrument handle

data Metrics Source #

Domain instruments. WAI emits http.server.request.duration from its own meter.

newMetrics :: Telemetry -> IO Metrics Source #

Build instruments on the telemetry meter, or the SDK's no-op meter when disabled.

The core recording ports

metricsPortOf :: Metrics -> MetricsPort Source #

Project the instruments onto the core MetricsPort that Ecluse.Core.Server.Pipeline records through. It is inert when telemetry is off, since the instruments are.

workerMetricsPortOf :: Metrics -> WorkerMetricsPort Source #

Project the instruments onto the core WorkerMetricsPort that Ecluse.Core.Worker records through. It is inert when telemetry is off, since the instruments are.

dredgerMetricsPortOf :: Metrics -> DredgerMetricsPort Source #

Project the instruments onto the core DredgerMetricsPort that Ecluse.Core.Registry.Sweep records through. It is inert when telemetry is off, since the instruments are.

advisorySyncMetricsPortOf :: Metrics -> AdvisorySyncMetricsPort Source #

Project the instruments onto the core AdvisorySyncMetricsPort that Ecluse.Runtime.Cve.Sync records through. It is inert when telemetry is off, since the instruments are.

advisoryCompileMetricsPortOf :: Metrics -> Maybe Ecosystem -> AdvisoryCompileMetricsPort Source #

Bind compile observations to an ecosystem. An unknown ecosystem records no series.

The signals the deferred reporters feed directly

recordBreakerState :: MonadIO m => Metrics -> BreakerSource -> BreakerState -> m () Source #

Record the current circuit-breaker state (ecluse.rule.breaker.state) for a source as the gauge's bounded ordinal (0 closed, 1 half-open, 2 open).

recordMirrorEnqueueFailure :: MonadIO m => Metrics -> m () Source #

Record one mirror enqueue failure (ecluse.mirror.enqueue.failures).

recordCredentialRefresh :: MonadIO m => Metrics -> Provider -> CredentialResult -> m () Source #

Record one credential refresh (ecluse.credential.refresh) by result and provider.

registerCredentialTokenTtl :: Metrics -> IO UTCTime -> IO [(Provider, UTCTime)] -> IO () Source #

Collect the shortest active expiry per provider as non-negative whole seconds remaining.

Advisory ages (observable)

registerAdvisoryDatabaseAge :: Metrics -> Ecosystem -> IO (Maybe Double) -> IO () Source #

Attach one ecosystem's advisory-database age to ecluse.advisory.database.age.seconds. The SDK calls back at each collection, so a sync task that dies cannot freeze or reset the age.

registerAdvisorySourceAge :: Metrics -> Ecosystem -> IO (Maybe UTCTime) -> IO () Source #

Attach one ecosystem's advisory-source age to ecluse.advisory.source.age.seconds: the age the CVE-deny path expires on, where registerAdvisoryDatabaseAge is an installation diagnostic.

Memory budget (observable)

registerMemoryMeter :: Metrics -> IO MeterSnapshot -> IO () Source #

Attach the memory meter's figures to their gauges, read at each collection.