#metrics #tracing #prometheus #open-telemetry

opinionated_telemetry

Opinionated configuration for tracing and metrics crates (with OpenTelemetry & Prometheus)

2 unstable releases

0.2.0 Sep 11, 2023
0.1.0 Sep 8, 2023

#780 in Debugging


Used in dbcrossbar

Apache-2.0 OR MIT

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.

Documentation

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.
  • OpenTelemetry and W3C Trace Context are a popular choice for tracing.
    • But tracing backends are less standardized than Prometheus.
  • Rust's tracing and metrics 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:

Metrics:

  • Prometheus (scraping)
  • Prometheus (push gateway)
  • Debug (logged via tracing)

Dependencies

~24–36MB
~641K SLoC