Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ tokio::spawn(do_work());

If you also enable the `metrics-rs-integration` feature, you can use [metrics.rs] exporters to export metrics outside of your process. `metrics.rs` supports a variety of exporters, including [Prometheus].

The exported metrics by default will be exported with their name, preceded by `tokio_`. For example, `tokio_workers_count` for the [`workers_count`] metric. This can be customized by using the `with_metrics_tranformer` function.
The exported metrics by default will be exported with their name, preceded by `tokio_`. For example, `tokio_workers_count` for the [`workers_count`] metric. This can be customized by using the [`with_metrics_tranformer`] function.

If you want to use [Prometheus], you could have this `Cargo.toml`:

[Prometheus]: https://prometheus.io
[`with_metrics_tranformer`]: https://docs.rs/tokio-metrics/0.4.*/tokio_metrics/struct.RuntimeMetricsReporterBuilder.html#method.with_metrics_transformer

```toml
[dependencies]
tokio-metrics = { version = "0.4.1", features = ["metrics-rs-integration"] }
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ If the `metrics-rs-integration` feature is additionally enabled, this crate allo
publishing runtime metrics externally via [metrics-rs](metrics) exporters.

For example, you can use [metrics_exporter_prometheus] to make metrics visible
to Prometheus. You can see the [metrics_exporter_prometheus] and [metrics-rs](metrics)
to [Prometheus]. You can see the [metrics_exporter_prometheus] and [metrics-rs](metrics)
docs for guidance on configuring exporters.

The published metrics are the same as the fields of [RuntimeMetrics], but with
a "tokio_" prefix added, for example `tokio_workers_count`.

[metrics_exporter_prometheus]: https://docs.rs/metrics_exporter_prometheus
[RuntimeMetrics]: crate::RuntimeMetrics
[Prometheus]: https://prometheus.io

This example exports Prometheus metrics by listening on a local Unix socket
This example exports [Prometheus] metrics by listening on a local Unix socket
called `prometheus.sock`, which you can access for debugging by
`curl --unix-socket prometheus.sock localhost`.

Expand Down
Loading