#telemetry #json #telemetry-metrics #metrics

metrics-observer-json

A metrics-core compatible observer that outputs JSON

2 releases

0.1.1 Jul 30, 2019
0.1.0 Jul 30, 2019

#32 in #telemetry-metrics

Download history 545/week @ 2025-09-22 1076/week @ 2025-09-29 731/week @ 2025-10-06 661/week @ 2025-10-13 686/week @ 2025-10-20 628/week @ 2025-10-27 810/week @ 2025-11-03 914/week @ 2025-11-10 693/week @ 2025-11-17 579/week @ 2025-11-24 818/week @ 2025-12-01 505/week @ 2025-12-08 571/week @ 2025-12-15 462/week @ 2025-12-22 722/week @ 2025-12-29 676/week @ 2026-01-05

2,508 downloads per month
Used in 11 crates (2 directly)

MIT license

195KB
3.5K SLoC

Observes metrics in JSON format.

Metric scopes are used to provide the hierarchy of metrics. As an example, for a snapshot with two metrics — server.msgs_received and server.msgs_sent — we would expect to see this output:

{"server":{"msgs_received":42,"msgs_sent":13}}

If we added another metric — configuration_reloads — we would expect to see:

{"configuration_reloads":2,"server":{"msgs_received":42,"msgs_sent":13}}

Metrics are sorted alphabetically.

Histograms

Histograms are rendered with a configurable set of quantiles that are provided when creating an instance of JsonBuilder. They are formatted using human-readable labels when displayed to the user. For example, 0.0 is rendered as "min", 1.0 as "max", and anything in between using the common "pXXX" format i.e. a quantile of 0.5 or percentile of 50 would be p50, a quantile of 0.999 or percentile of 99.9 would be p999, and so on.

All histograms have the sample count of the histogram provided in the output.

{"connect_time_count":15,"connect_time_min":1334,"connect_time_p50":1934,
"connect_time_p99":5330,"connect_time_max":139389}

metrics-observer-json

conduct-badge downloads-badge release-badge docs-badge license-badge

metrics-observer-json is a metrics-core compatible observer that outputs JSON.

code of conduct

NOTE: All conversations and contributions to this project shall adhere to the Code of Conduct.

Dependencies

~1.3–2MB
~36K SLoC