ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.Scrape.Internal

Description

The exposition handle, the listener address reads, and the WAI application behind Ecluse.Runtime.Telemetry.Scrape, which documents the transport 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 collection handle

newtype MetricScrape Source #

One on-demand collection of the meter's current series. The substrate builds one only where the operator asked for the scrape transport.

metricScrapeFor :: SdkMeterEnv -> IO (Maybe MetricScrape) Source #

Build the scrape handle, or Nothing when the transport stayed on OTLP push. Collecting beside the periodic reader is safe only under cumulative temporality: delta would split the points.

scrapeSelected :: IO Bool Source #

Whether OTEL_METRICS_EXPORTER names the Prometheus transport. It reads the SDK's own parse of the variable, so the listener and the exporter the SDK resolves cannot disagree over one value.

The dedicated listener

data ScrapeListener Source #

Where the scrape listener binds.

Constructors

ScrapeListener 

Fields

  • slHost :: Text

    The bind address, loopback unless the operator widened it.

  • slPort :: Int

    The TCP port, 9464 by the OpenTelemetry specification's default.

scrapeListenerFrom :: [(String, String)] -> ScrapeListener Source #

Resolve the listener from an environment. The defaults reach no interface but the loopback, so publishing the exposition any wider is an operator's deliberate act.

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

The warnings this environment raises. withScrapeListener surfaces them before it binds.

scrapeApplication :: MetricScrape -> Application Source #

Answer /metrics with the Prometheus text exposition of the current series, and every other path with a plain 404. This is the whole surface of the dedicated listener.

withScrapeListener :: LogEnv -> Maybe MetricScrape -> IO a -> IO a Source #

Run act with the scrape listener alive when the transport selected one, and unchanged when it did not. A listener that cannot bind is reported and abandoned, never a failed boot.