Skip to content

Commit fe4c78c

Browse files
committed
[Refactor] Complete metrics overhaul
Metrics got an entire overhaul. Instead of relying on a broken prometheus library to publish our metrics, we now use the `tracing` library and with OpenTelemetry that we bind together then publish into a prometheus library. Metrics are now mostly derive-macros. This means that the struct can express what it wants to export and a help text. The library will choose if it is able to export it. Tracing now works by calling `.publish()` on the parent structs, those structs need to call `.publish()` on all the child members it wishes to publish data about. If a "group" is requested, use the `group!()` macro, which under-the-hood calls `tracing::span` with some special labels. At primitive layers, it will call the `publish!()` macro, which will call `tracing::event!()` macro under-the-hood with some special fields set. A custom `tracing::Subscriber` will intercept all the events and spans and convert them into a json-like object. This object can then be exported as real json or encoded into other formats like otel/prometheus. closes: #1164, #650, #384, #209 towards: #206
1 parent 3574149 commit fe4c78c

File tree

80 files changed

+2675
-1466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2675
-1466
lines changed

BUILD.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,25 @@ rust_binary(
2222
"//nativelink-store",
2323
"//nativelink-util",
2424
"//nativelink-worker",
25+
"//nativelink-metric",
26+
"//nativelink-metric-collector",
2527
"@crates//:async-lock",
2628
"@crates//:axum",
2729
"@crates//:clap",
30+
"@crates//:opentelemetry",
31+
"@crates//:opentelemetry-prometheus",
32+
"@crates//:opentelemetry_sdk",
33+
"@crates//:tracing-subscriber",
2834
"@crates//:futures",
2935
"@crates//:hyper",
36+
"@crates//:prometheus",
3037
"@crates//:mimalloc",
3138
"@crates//:parking_lot",
3239
"@crates//:prometheus-client",
3340
"@crates//:rustls-pemfile",
3441
"@crates//:scopeguard",
3542
"@crates//:serde_json5",
43+
"@crates//:serde_json",
3644
"@crates//:tokio",
3745
"@crates//:tokio-rustls",
3846
"@crates//:tonic",

0 commit comments

Comments
 (0)