2 unstable releases
0.2.0 | Sep 11, 2023 |
---|---|
0.1.0 | Sep 8, 2023 |
#418 in Profiling
Used in dbcrossbar
62KB
1K
SLoC
opinionated_telemetry
: Easy-to-use backend for metrics
and tracing
This is a single crate that provides a simple, opinionated backend for metrics
and tracing
. The goal is to easily enable an existing Rust app to emit metrics and traces, without having to spend a lot of effort on configuration.
This crate's opinions
All opionated software should try to list what opinions it holds, so users know whether it's a good fit for them. Here are the opinions of this crate:
- Tracing and metrics are incredibly useful, and should be ubiquitous.
- This includes CLI tools, not just servers!
- Prometheus and Grafana are a solid combination for metrics and dashboards.
- CLI tools should normally use
prom-aggregation-gateway
instead of Prometheuspushgateway
.
- CLI tools should normally use
- OpenTelemetry and W3C Trace Context are a popular choice for tracing.
- But tracing backends are less standardized than Prometheus.
- Rust's
tracing
andmetrics
façades are good enough to handle the basics, and reasonably standard. - "Labels" on metrics should be carefully chosen and "low-arity" (having few possible values). Therefore, inheriting labels from parent scopes is almost always the wrong thing to do.
Supported backends
Tracing:
- Vendors
- Jaeger (not yet supported, but we'd love a PR)
- Debug (printed to stderr)
Metrics:
- Prometheus (scraping)
- Prometheus (push gateway)
- Debug (logged via
tracing
)
Dependencies
~24–36MB
~635K SLoC