Skip to content

wire dashboard to per-track metrics (#533) - #539

Open
gmarzot wants to merge 7 commits into
mainfrom
feature/track-metrics-533
Open

wire dashboard to per-track metrics (#533)#539
gmarzot wants to merge 7 commits into
mainfrom
feature/track-metrics-533

Conversation

@gmarzot

@gmarzot gmarzot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Blocked on #533. Prepared so the dashboard can move onto real per-track data as soon as it lands.

In this branch: a moqx-track scrape job. Every query parameter on /metrics/track is optional, so a single target covers all namespaces; limit is set to the 1000 ceiling.

To follow once #533 merges, replacing placeholders in the tracks table:

column source
Subs moqx_track_subscribers
Peak max_over_time(moqx_track_subscribers[$__range])
Bitrate rate(moqx_track_bytes_received_total[1m]) * 8
Data Tx moqx_track_bytes_sent_total
Status time() - moqx_track_last_object_timestamp_seconds

This also retires the /state json-exporter path for per-track data, whose entries are transient and undercount under load (#501).

Type/Codec/Resolution/FPS stay : they are catalog attributes, not metrics.

Notes carried from #533's shape

  • Series exist only for live tracks and restart from zero if a track returns, so counters want rate()/increase() rather than deltas across a lifetime.
  • Label values are encoded (moq-test/interop -> moq.2dtest-interop), so tables show the encoded form unless decoded for display.
  • Past 1000 live tracks the scrape must split by namespace prefix; /state.namespace_tree can generate that target list into a file_sd file. Noted in docker/prometheus/README.md.
  • Untested: the endpoint does not exist yet.

This change is Reviewable

@gmarzot gmarzot self-assigned this Aug 3, 2026
@gmarzot
gmarzot marked this pull request as ready for review August 10, 2026 15:31
@gmarzot
gmarzot force-pushed the feature/track-metrics-533 branch from 12e0746 to 284a044 Compare August 10, 2026 15:31
@gmarzot
gmarzot requested a review from afrind August 10, 2026 15:32
@gmarzot gmarzot changed the title Draft: wire dashboard to per-track metrics (#533) wire dashboard to per-track metrics (#533) Aug 10, 2026
@gmarzot

gmarzot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

waiting got PR#533 to merge

Namespace is a required parameter and there is no enumeration endpoint, so
namespaces are targets relabelled into the query. The static list should be
generated from /state.namespace_tree into a file_sd file; noted in the README.

Needs #533.
Rework of #533 made every query parameter optional, so one
target covers all namespaces instead of a per-namespace list. Namespace
splitting is only needed past the endpoint's limit ceiling; noted in the
README along with the label encoding and the live-tracks-only lifetime.
/metrics/track takes one namespace per request and rejects a match wider
than its limit, so an unscoped scrape fails once the relay's total track
count passes the limit and takes every namespace with it. Scoping per
namespace keeps working until a single namespace passes it.

Namespaces change as events start and end, so ns-targets walks the relay's
namespace tree and writes the file_sd target list; Prometheus rereads it
without a restart. Encoding matches the endpoint's safe form.
/metrics/track matches a namespace prefix, so a parent and its child return
the same tracks and every aggregate double-counts. Targets are top-level
namespaces only: they do not overlap and their prefixes still cover
everything beneath them.

The endpoint documents itself as enabled by default but the resolved value
was false, so it shipped dead; the deployed config states it explicitly.
@gmarzot
gmarzot force-pushed the feature/track-metrics-533 branch from 96ef6ef to 3ba4740 Compare August 11, 2026 18:09
Both sources emitted moqx_track_subscribers, so leaving the /state module in
place would blend two label schemes into one metric name. The relay's own
counters are durable where /state's entries are transient (#501),
and they carry bytes and object counts /state never had.

Tracks table gains real Bitrate (ingest rate) and Data Tx (delivered payload).
The deployed config sets track_metrics_enabled explicitly, so the header
default does not matter here. Whether it should be true — the descriptions
say so while the value is false — is #558 to settle.
mkstemp creates 0600 and the generator runs as root, so prometheus (nobody)
could not read the target file: it was written correctly and every target
was silently absent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant