Skip to content

Commit 23a64cf

Browse files
authored
[Breaking] Remove experimental_prometheus and disable_metrics (#1686)
These options were never useful as the metrics exposed didn't follow usable Prometheus structure. This change removes the public-facing configuration options related to the prometheus service. We keep the internals of the metric gathering infrastructure around as that's being migrated to a new OpenTelemetry setup. Fixes GHSA-2gh3-rmm4-6rq5
1 parent 5f4bbbf commit 23a64cf

File tree

18 files changed

+32
-520
lines changed

18 files changed

+32
-520
lines changed

BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ rust_binary(
3232
"@crates//:hyper-util",
3333
"@crates//:mimalloc",
3434
"@crates//:opentelemetry",
35-
"@crates//:opentelemetry-prometheus",
3635
"@crates//:opentelemetry_sdk",
3736
"@crates//:parking_lot",
38-
"@crates//:prometheus",
3937
"@crates//:rustls-pemfile",
4038
"@crates//:scopeguard",
4139
"@crates//:serde_json",

Cargo.lock

Lines changed: 0 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ tracing = { version = "0.1.41", default-features = false }
5757
opentelemetry_sdk = { version = "0.29.0", default-features = false }
5858
tracing-subscriber = { version = "0.3.19", default-features = false }
5959
opentelemetry = { version = "0.29.1", default-features = false }
60-
prometheus = { version = "0.13.4", default-features = false }
61-
opentelemetry-prometheus = "0.29.0"
62-
serde_json = "1.0.140"
6360

6461
[workspace.cargo-features-manager.keep]
6562
async-lock = ["std"]

deployment-examples/docker-compose/local-storage-cas.json5

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@
5959
}
6060
}
6161
}, {
62-
// Only publish metrics on a private port.
63-
"listener": {
64-
"http": {
65-
"socket_address": "0.0.0.0:50061"
66-
}
67-
},
68-
"services": {
69-
"experimental_prometheus": {
70-
"path": "/metrics"
71-
}
72-
}
73-
},
74-
{
7562
"listener": {
7663
"http": {
7764
"socket_address": "0.0.0.0:50071",

integration_tests/simple_prometheus_test.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

kubernetes/nativelink/nativelink-config.json5

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,6 @@
7272
}
7373
],
7474
"servers": [{
75-
// Only publish metrics on a private port.
76-
"listener": {
77-
"http": {
78-
"socket_address": "0.0.0.0:9090"
79-
}
80-
},
81-
"services": {
82-
"experimental_prometheus": {
83-
"path": "/metrics"
84-
}
85-
}
86-
},
87-
{
8875
"listener": {
8976
"http": {
9077
"socket_address": "0.0.0.0:50051"

nativelink-config/examples/README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ The `public` server consists of a `listener` object and a `services` object. The
312312

313313
> ⚠️ _WARNING_: A private server shouldn't be exposed to the public. ⚠️
314314
315-
The `private` server consists of a `listener` object and a `services` object. The `listener` object is one level and includes an `http` with a `socket address`. The `services` server consists of an `experimental_prometheus` object with a `path` field, a `worker_api` object with `scheduler_field`, and an `admin` object.
315+
The `private` server consists of a `listener` object and a `services` object. The `listener` object is one level and includes an `http` with a `socket address`. The `services` server consists of a `worker_api` object with `scheduler_field` and an `admin` object.
316316

317317
```json5
318318
{
@@ -364,9 +364,6 @@ The `private` server consists of a `listener` object and a `services` object. Th
364364
}
365365
},
366366
"services": {
367-
"experimental_prometheus": {
368-
"path": "/metrics"
369-
},
370367
// Note: This should be served on a different port, because it has
371368
// a different permission set than the other services.
372369
// In other words, this service is a backend api. The ones above
@@ -548,9 +545,6 @@ Below, you will find a fully tested example that you can also find in [basic_cas
548545
}
549546
},
550547
"services": {
551-
"experimental_prometheus": {
552-
"path": "/metrics"
553-
},
554548
// Note: This should be served on a different port, because it has
555549
// a different permission set than the other services.
556550
// In other words, this service is a backend api. The ones above

nativelink-config/examples/basic_cas.json5

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@
142142
}
143143
},
144144
"services": {
145-
"experimental_prometheus": {
146-
"path": "/metrics"
147-
},
148145
// Note: This should be served on a different port, because it has
149146
// a different permission set than the other services.
150147
// In other words, this service is a backend api. The ones above

nativelink-config/examples/redis.json5

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,6 @@
6969
}
7070
}
7171
}
72-
},
73-
{
74-
"listener": {
75-
"http": {
76-
"socket_address": "0.0.0.0:50061"
77-
}
78-
},
79-
"services": {
80-
"experimental_prometheus": {
81-
"path": "/metrics"
82-
}
83-
}
8472
}
8573
]
8674
}

nativelink-config/src/cas_server.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,6 @@ pub struct WorkerApiConfig {
167167
pub scheduler: SchedulerRefName,
168168
}
169169

170-
#[derive(Deserialize, Debug, Default)]
171-
#[serde(deny_unknown_fields)]
172-
pub struct PrometheusConfig {
173-
/// Path to register prometheus metrics. If path is "/metrics", and your
174-
/// domain is "example.com", you can reach the endpoint with:
175-
/// <http://example.com/metrics>.
176-
///
177-
/// Default: "/metrics"
178-
#[serde(default)]
179-
pub path: String,
180-
}
181-
182170
#[derive(Deserialize, Debug, Default)]
183171
#[serde(deny_unknown_fields)]
184172
pub struct AdminConfig {
@@ -287,10 +275,6 @@ pub struct ServicesConfig {
287275
/// publish them to a store for processing by an external service.
288276
pub experimental_bep: Option<BepConfig>,
289277

290-
/// Experimental - Prometheus metrics configuration. Metrics are gathered
291-
/// as a singleton but may be served on multiple endpoints.
292-
pub experimental_prometheus: Option<PrometheusConfig>,
293-
294278
/// This is the service for any administrative tasks.
295279
/// It provides a REST API endpoint for administrative purposes.
296280
pub admin: Option<AdminConfig>,
@@ -716,19 +700,6 @@ pub struct GlobalConfig {
716700
#[serde(deserialize_with = "convert_numeric_with_shellexpand")]
717701
pub max_open_files: usize,
718702

719-
/// This flag can be used to prevent metrics from being collected at runtime.
720-
/// Metrics are still able to be collected, but this flag prevents metrics that
721-
/// are collected at runtime (performance metrics) from being tallied. The
722-
/// overhead of collecting metrics is very low, so this flag should only be
723-
/// used if there is a very good reason to disable metrics.
724-
/// This flag can be forcibly set using the `NATIVELINK_DISABLE_METRICS` variable.
725-
/// If the variable is set it will always disable metrics regardless of what
726-
/// this flag is set to.
727-
///
728-
/// Default: <true (disabled) if no prometheus service enabled, false otherwise>
729-
#[serde(default)]
730-
pub disable_metrics: bool,
731-
732703
/// Default hash function to use while uploading blobs to the CAS when not set
733704
/// by client.
734705
///

0 commit comments

Comments
 (0)