Skip to content

Add per-input and per-output Prometheus metrics - #676

Merged
jvde-github merged 2 commits into
jvde-github:mainfrom
snh:prometheus-input-output-metrics
Nov 2, 2026
Merged

jvde-github merged 2 commits into
jvde-github:mainfrom
snh:prometheus-input-output-metrics

Conversation

@snh

@snh snh commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What

Extends the /metrics endpoint (enabled with PROME on) with metrics for each input and output. The existing global ais_stat_* metrics are unchanged.

Inputs

Labels: input, type, description. description is the user-supplied value from the config, falling back to a derived name when empty.

Metric Notes
ais_input_count Messages decoded
ais_input_bytes_in Raw bytes received
ais_input_up Streaming and not lost (a UDP input is up once its socket is bound)
ais_input_last_message_timestamp_seconds 0 until the first message
ais_input_errors{error} checksum, undersized, oversized
ais_input_connect_ok, ais_input_connect_fail, ais_input_reconnects, ais_input_connected RTLTCP and SpyServer only

Outputs

Labels: output, type, description.

Metric Notes
ais_output_count Messages passing the output's filter, counted once per message
ais_output_bytes_out Wire bytes sent. For the TCP listener this is the total across clients
ais_output_bytes_in
ais_output_dropped For the TCP listener, one per client disconnected for not reading
ais_output_connect_ok, ais_output_connect_fail, ais_output_reconnects, ais_output_connected Connection-based outputs only. For the TCP listener, connected is the client count

Supporting changes

  • Receiver::description now keeps the JSON config description (it was parsed and discarded).
  • IO::OutputStats gains messages, which is also included in the JSON output.
  • New Device::isUp() has no side effects. isStreaming() can read the WAV file and feed the decoder, so it isn't safe to call from the metrics path.
  • New Device::getConnectionStats(), overridden by RTLTCP and SpyServer.
  • New OutputMessage::hasConnection(), so connectionless outputs skip the connection metrics.
  • DatabaseOutput now counts messages.
  • New Dockerfile.dev builds from the checkout. The main Dockerfile installs the upstream release, so it can't be used to test local changes.

snh added 2 commits November 1, 2026 11:03
Add ais_input_* and ais_output_* metrics (counts, bytes, up/connected,
connect/reconnect counters, last message time, input errors). Connection
series are only emitted for inputs and outputs that hold a connection.
Receivers accept a user-supplied description used as the input label.
The main Dockerfile installs the prebuilt upstream release, so it never
contains local changes.
@jvde-github
jvde-github merged commit 934a4bd into jvde-github:main Nov 2, 2026
55 checks passed
@snh
snh deleted the prometheus-input-output-metrics branch November 3, 2026 12:59
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.

2 participants