| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Telemetry.Metrics
Description
The ecluse.* metric catalogue and its bounded-label discipline.
An inline proxy sees thousands of distinct packages, so the failure mode for metrics is a series explosion: a single high-cardinality label (a package name, a version, a denial message) multiplied across every package turns a handful of series into millions. This module is the structural defence. It defines the catalogue of metric names and, crucially, the closed set of label types a metric may carry -- every one a small, fixed-domain enum.
Bounded labels
The label vocabulary is a closed sum, Label, whose every constructor pairs a
bounded-domain key with a bounded value. High-cardinality identifiers -- package,
version, scope, and a denial message -- have no constructor here at all, so
they cannot be made into a metric label: the type system forbids it. They live on
spans and the structured log line (Ecluse.Log) instead, which is where a specific
decision is debugged. The one operator-bounded label is rule (a rule's configured
name): a deployment defines a small, fixed set of rules, so it is bounded by
configuration rather than by an enum, and is the sole label carrying free text.
renderLabel projects a Label to its (key, value) wire pair, and metricAttributes
materialises a label list into the OpenTelemetry Attributes an instrument is recorded
with. The catalogue and the cardinality rule are described in
docs/architecture/observability.md.
Synopsis
- data MetricName
- = HttpServerRequestDuration
- | ServeDecision
- | RuleDenials
- | RuleEvalDuration
- | RuleEffectfulFailures
- | RuleBreakerState
- | ServeAdmissionInFlight
- | ServeAdmissionQueued
- | UpstreamFetchDuration
- | UpstreamFetchErrors
- | MetadataCacheRequests
- | MetadataCacheEntries
- | MetadataCacheResidentBytes
- | SingleVersionCacheResidentBytes
- | AssembledCacheResidentBytes
- | MirrorEnqueued
- | MirrorEnqueueFailures
- | MirrorJobsProcessed
- | MirrorPublishDuration
- | CredentialRefresh
- | CredentialTokenTtlSeconds
- metricName :: MetricName -> Text
- allMetricNames :: [MetricName]
- data LabelKey
- labelKeyName :: LabelKey -> Text
- allLabelKeys :: [LabelKey]
- highCardinalityKeys :: [Text]
- data Decision
- = Admit
- | Deny
- | Unavailable
- data ReasonClass
- data Upstream
- data StatusClass
- statusClassOf :: Int -> StatusClass
- data Provider
- = CodeArtifact
- | Static
- | Adc
- data Cause
- data Tier
- data CacheResult
- data MirrorResult
- data CredentialResult
- data BreakerSource
- data BreakerState
- breakerStateCode :: BreakerState -> Int64
- data Label
- = LDecision Decision
- | LReasonClass ReasonClass
- | LRule Text
- | LEcosystem Ecosystem
- | LMount Ecosystem
- | LUpstream Upstream
- | LStatusClass StatusClass
- | LCacheResult CacheResult
- | LMirrorResult MirrorResult
- | LCredentialResult CredentialResult
- | LProvider Provider
- | LCause Cause
- | LBreakerSource BreakerSource
- | LTier Tier
- labelKey :: Label -> LabelKey
- renderLabel :: Label -> (Text, Text)
- metricAttributes :: [Label] -> Attributes
The metric-name catalogue
data MetricName Source #
The catalogue of metric instruments Écluse emits: the ecluse.* domain signals
plus the OpenTelemetry HTTP server semantic convention. Each maps to its wire name
through metricName; a typed enum so the catalogue is enumerable (and asserted whole
in the tests) rather than a scatter of string literals.
Queue backlog and DLQ depth are deliberately absent -- those are cloud-native metrics (CloudWatch, Cloud Monitoring), not signals Écluse re-emits. Advisory-sync metrics are deferred until the advisory subsystem exists.
Constructors
| HttpServerRequestDuration |
|
| ServeDecision |
|
| RuleDenials |
|
| RuleEvalDuration |
|
| RuleEffectfulFailures |
|
| RuleBreakerState |
|
| ServeAdmissionInFlight |
|
| ServeAdmissionQueued |
|
| UpstreamFetchDuration |
|
| UpstreamFetchErrors |
|
| MetadataCacheRequests |
|
| MetadataCacheEntries |
|
| MetadataCacheResidentBytes |
|
| SingleVersionCacheResidentBytes |
|
| AssembledCacheResidentBytes |
|
| MirrorEnqueued |
|
| MirrorEnqueueFailures |
|
| MirrorJobsProcessed |
|
| MirrorPublishDuration |
|
| CredentialRefresh |
|
| CredentialTokenTtlSeconds |
|
Instances
| Generic MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> MetricName -> ShowS # show :: MetricName -> String # showList :: [MetricName] -> ShowS # | |||||
| Eq MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Ord MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods compare :: MetricName -> MetricName -> Ordering # (<) :: MetricName -> MetricName -> Bool # (<=) :: MetricName -> MetricName -> Bool # (>) :: MetricName -> MetricName -> Bool # (>=) :: MetricName -> MetricName -> Bool # max :: MetricName -> MetricName -> MetricName # min :: MetricName -> MetricName -> MetricName # | |||||
| Universe MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [MetricName] Source # | |||||
| type Rep MetricName Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep MetricName = D1 ('MetaData "MetricName" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) ((((C1 ('MetaCons "HttpServerRequestDuration" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ServeDecision" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RuleDenials" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RuleEvalDuration" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RuleEffectfulFailures" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "RuleBreakerState" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ServeAdmissionInFlight" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ServeAdmissionQueued" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UpstreamFetchDuration" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UpstreamFetchErrors" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "MetadataCacheRequests" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MetadataCacheEntries" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MetadataCacheResidentBytes" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SingleVersionCacheResidentBytes" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AssembledCacheResidentBytes" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "MirrorEnqueued" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MirrorEnqueueFailures" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MirrorJobsProcessed" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "MirrorPublishDuration" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CredentialRefresh" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CredentialTokenTtlSeconds" 'PrefixI 'False) (U1 :: Type -> Type)))))) | |||||
metricName :: MetricName -> Text Source #
The wire name of a MetricName.
allMetricNames :: [MetricName] Source #
Every metric in the catalogue (the Generic-derived Universe enumeration).
Label keys (the closed set)
The closed set of metric label keys. Every label Écluse attaches is one of these
bounded-domain keys. High-cardinality identifiers (package, version, scope, a
denial message) are deliberately absent -- see highCardinalityKeys -- so they
can never become a metric label.
Constructors
| KeyDecision | |
| KeyReasonClass | |
| KeyRule | |
| KeyEcosystem | |
| KeyMount | |
| KeyUpstream | |
| KeyStatusClass | |
| KeyResult | |
| KeyProvider | |
| KeyCause | |
| KeyBreakerSource | |
| KeyTier |
Instances
| Generic LabelKey Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show LabelKey Source # | |||||
| Eq LabelKey Source # | |||||
| Ord LabelKey Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Universe LabelKey Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| type Rep LabelKey Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep LabelKey = D1 ('MetaData "LabelKey" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) (((C1 ('MetaCons "KeyDecision" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KeyReasonClass" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KeyRule" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "KeyEcosystem" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KeyMount" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KeyUpstream" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "KeyStatusClass" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KeyResult" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KeyProvider" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "KeyCause" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KeyBreakerSource" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KeyTier" 'PrefixI 'False) (U1 :: Type -> Type))))) | |||||
allLabelKeys :: [LabelKey] Source #
Every label key in the closed set.
highCardinalityKeys :: [Text] Source #
Bounded label values
The serve decision (ecluse.serve.decision).
Constructors
| Admit | |
| Deny | |
| Unavailable |
Instances
| Generic Decision Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show Decision Source # | |||||
| Eq Decision Source # | |||||
| Universe Decision Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| type Rep Decision Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep Decision = D1 ('MetaData "Decision" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) (C1 ('MetaCons "Admit" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Deny" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Unavailable" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
data ReasonClass Source #
The bucketed class of a denial reason -- a bounded summary of Ecluse.Core.Server.Response.RejectReason, not the rule name or the message (those are high-cardinality and stay on the log line).
Instances
Which upstream a data-plane fetch targeted.
data StatusClass Source #
The HTTP status class of an upstream response (the bounded summary of the code).
Constructors
| Status2xx | |
| Status3xx | |
| Status4xx | |
| Status5xx | |
| StatusOther |
Instances
| Generic StatusClass Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show StatusClass Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> StatusClass -> ShowS # show :: StatusClass -> String # showList :: [StatusClass] -> ShowS # | |||||
| Eq StatusClass Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Universe StatusClass Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [StatusClass] Source # | |||||
| type Rep StatusClass Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep StatusClass = D1 ('MetaData "StatusClass" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) ((C1 ('MetaCons "Status2xx" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Status3xx" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Status4xx" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Status5xx" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StatusOther" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
statusClassOf :: Int -> StatusClass Source #
Classify an HTTP status code into its bounded StatusClass, so a status never
becomes a per-code label.
The outbound-credential provider a refresh/ttl signal concerns.
Constructors
| CodeArtifact | |
| Static | |
| Adc |
Instances
| Generic Provider Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show Provider Source # | |||||
| Eq Provider Source # | |||||
| Universe Provider Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| type Rep Provider Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep Provider = D1 ('MetaData "Provider" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) (C1 ('MetaCons "CodeArtifact" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Static" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Adc" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
A bounded error class for a failure signal (never the exception text).
Constructors
| Timeout | |
| Connection | |
| Decode | |
| UpstreamStatus | |
| OtherCause |
Instances
| Generic Cause Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show Cause Source # | |||||
| Eq Cause Source # | |||||
| Universe Cause Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| type Rep Cause Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep Cause = D1 ('MetaData "Cause" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) ((C1 ('MetaCons "Timeout" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Connection" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Decode" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UpstreamStatus" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherCause" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
The rule-evaluation tier a duration is measured at.
Constructors
| Structural | |
| Effectful |
data CacheResult Source #
A metadata-cache lookup result.
Instances
| Generic CacheResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show CacheResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> CacheResult -> ShowS # show :: CacheResult -> String # showList :: [CacheResult] -> ShowS # | |||||
| Eq CacheResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Universe CacheResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [CacheResult] Source # | |||||
| type Rep CacheResult Source # | |||||
data MirrorResult Source #
A processed mirror job's result. The idempotent "already present" outcome (a
registry 409) is not a distinct value: the worker treats it as a success, so it is
counted as Published -- a series that could never emit is not published.
Instances
| Generic MirrorResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show MirrorResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> MirrorResult -> ShowS # show :: MirrorResult -> String # showList :: [MirrorResult] -> ShowS # | |||||
| Eq MirrorResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Universe MirrorResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [MirrorResult] Source # | |||||
| type Rep MirrorResult Source # | |||||
data CredentialResult Source #
A credential-refresh result.
Constructors
| Refreshed | |
| RefreshFailed |
Instances
| Generic CredentialResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
Methods from :: CredentialResult -> Rep CredentialResult x # to :: Rep CredentialResult x -> CredentialResult # | |||||
| Show CredentialResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> CredentialResult -> ShowS # show :: CredentialResult -> String # showList :: [CredentialResult] -> ShowS # | |||||
| Eq CredentialResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods (==) :: CredentialResult -> CredentialResult -> Bool # (/=) :: CredentialResult -> CredentialResult -> Bool # | |||||
| Universe CredentialResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [CredentialResult] Source # | |||||
| type Rep CredentialResult Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
data BreakerSource Source #
Which circuit breaker a state gauge concerns.
Constructors
| EffectfulRule | |
| CredentialMint |
Instances
| Generic BreakerSource Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show BreakerSource Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> BreakerSource -> ShowS # show :: BreakerSource -> String # showList :: [BreakerSource] -> ShowS # | |||||
| Eq BreakerSource Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods (==) :: BreakerSource -> BreakerSource -> Bool # (/=) :: BreakerSource -> BreakerSource -> Bool # | |||||
| Universe BreakerSource Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [BreakerSource] Source # | |||||
| type Rep BreakerSource Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
Breaker state (a bounded gauge value, not a label)
data BreakerState Source #
The circuit-breaker state, recorded as the value of the ecluse.rule.breaker.state
gauge (labelled by BreakerSource). It is a bounded measurement, not a label.
Instances
| Generic BreakerState Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Associated Types
| |||||
| Show BreakerState Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods showsPrec :: Int -> BreakerState -> ShowS # show :: BreakerState -> String # showList :: [BreakerState] -> ShowS # | |||||
| Eq BreakerState Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics | |||||
| Universe BreakerState Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics Methods universe :: [BreakerState] Source # | |||||
| type Rep BreakerState Source # | |||||
Defined in Ecluse.Core.Telemetry.Metrics type Rep BreakerState = D1 ('MetaData "BreakerState" "Ecluse.Core.Telemetry.Metrics" "ecluse-0.1.0-inplace-ecluse-core" 'False) (C1 ('MetaCons "Closed" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "HalfOpen" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Open" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
breakerStateCode :: BreakerState -> Int64 Source #
The gauge code for a breaker state: 0 closed, 1 half-open, 2 open -- a small
ordinal so a dashboard can alarm on "not closed" without a high-cardinality label.
Labels
A single metric label: a bounded key paired with its bounded value. There is no
constructor for a package, version, scope, or message, so a high-cardinality identifier
cannot be turned into a label. LRule carries a rule's configured name -- the one
operator-bounded label (a deployment defines a small, fixed rule set).
Constructors
| LDecision Decision | |
| LReasonClass ReasonClass | |
| LRule Text | |
| LEcosystem Ecosystem | |
| LMount Ecosystem | |
| LUpstream Upstream | |
| LStatusClass StatusClass | |
| LCacheResult CacheResult | |
| LMirrorResult MirrorResult | |
| LCredentialResult CredentialResult | |
| LProvider Provider | |
| LCause Cause | |
| LBreakerSource BreakerSource | |
| LTier Tier |
Instances
Attribute construction
metricAttributes :: [Label] -> Attributes Source #
Materialise a label list into the OpenTelemetry Attributes an instrument is
recorded with. Every value is bounded, so the attribute set an instrument ever sees is
drawn from a small fixed product of the label domains -- never the unbounded space of
package identifiers.