Skip to main content

Module labels

Module labels 

Source
Available on crate features metrics or otel-metrics only.
Expand description

Bounded label values for Prometheus / OTel metrics.

Each enum represents a label whose value set is fixed at compile time. Wrapping label arguments in these types stops free-form strings from sliding into metric labels and blowing up TSDB cardinality.

Variant choice aligns with industry conventions:

  • TransportKind – one variant per transport-* cargo feature; label values match OTel messaging.system.
  • FlushTrigger – standard buffer-flush triggers seen across Kafka producers and batch processors.
  • AuthFailureReason – RFC 6749 OAuth 2.0 + JWT-specific failure codes; label values are the RFC strings.
  • ValidationFailureReason – JSON Schema 2020-12 validator error categories.

No Other catch-all: every code path that names a failure must pick a variant. Add new variants here when a real new failure mode appears; never widen at the call site.

Enums§

AuthFailureReason
Authentication failure reason. RFC 6749 / OAuth 2.0 error codes plus the JWT-specific failure modes most apps observe.
FlushTrigger
Buffer-flush trigger. Bounded set covering the patterns in every batch processor I’ve seen.
TransportKind
Transport backend kind. One variant per transport-* cargo feature plus routed. Aligns with OTel messaging.system attribute values where they overlap (kafka, redis, http).
ValidationFailureReason
Payload validation failure reason. Categories mirror the JSON Schema 2020-12 validator error taxonomy (Ajv, python-jsonschema, et al.).