Skip to main content

Module metrics

Module metrics 

Source
Expand description

Prometheus metric scrape contract.

GET metrics::PATH returns 200 OK Prometheus text exposition with metrics::CONTENT_TYPE.

This is a scrape endpoint. Configure Prometheus to scrape metrics::PATH, then issue PromQL queries to Prometheus. Histogram families render <name>_bucket with the additional le label plus <name>_sum and <name>_count.

§Scrape and Query

scrape_configs:
  - job_name: o-sfu
    scheme: https
    metrics_path: /metrics
    authorization:
      type: Bearer
      credentials_file: /run/secrets/o_sfu_diagnostics_token
    tls_config:
      ca_file: /run/secrets/o_sfu_observability_ca
      server_name: o-sfu-observability.internal
    static_configs:
      - targets: ["o-sfu-observability.internal:443"]

The endpoint returns Prometheus text exposition.

# HELP osfu_rooms_active Current number of active rooms owned by this runtime.
# TYPE osfu_rooms_active gauge
osfu_rooms_active 3
# TYPE osfu_worker_rtp_packets_total counter
osfu_worker_rtp_packets_total{media_worker_id="0",direction="ingress"} 1240

Query clients send PromQL to the Prometheus-compatible backend rather than to o-sfu. These examples cover a gauge, counter and histogram.

sum(osfu_users_active)
sum by (stage) (rate(osfu_ws_connections_total[5m]))
histogram_quantile(
  0.95,
  sum by (le, route) (rate(osfu_http_request_duration_seconds_bucket[10m]))
)

Read the metrics::MetricName variants below to find every exported name and its meaning. Query metrics::PATH to see each family’s HELP, TYPE, label keys and current label values before building selectors.

Enums§

MetricName
Names every exported Prometheus metric family.

Constants§

CONTENT_TYPE
PATH
Prometheus scrape endpoint, not a PromQL API. See crate::http::telemetry::metrics for queries and examples.