Skip to content

Commit 2e3d5a8

Browse files
authored
Move Prometheus metrics endpoint to /api/v1/metrics (#289)
1 parent 7305195 commit 2e3d5a8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

server/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ fn ingest_path() -> String {
363363
"/ingest".to_string()
364364
}
365365

366+
pub fn metrics_path() -> String {
367+
format!("{}/metrics", base_path())
368+
}
369+
366370
fn alert_path(stream_name: &str) -> String {
367371
format!("{}/alert", logstream_path(stream_name))
368372
}

server/src/metrics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use actix_web_prometheus::{PrometheusMetrics, PrometheusMetricsBuilder};
2222
use lazy_static::lazy_static;
2323
use prometheus::{HistogramOpts, HistogramVec, IntCounterVec, IntGaugeVec, Opts, Registry};
2424

25-
use crate::metadata::STREAM_INFO;
25+
use crate::{metadata::STREAM_INFO, metrics_path};
2626

2727
pub const METRICS_NAMESPACE: &str = env!("CARGO_PKG_NAME");
2828

@@ -87,7 +87,7 @@ pub fn build_metrics_handler() -> PrometheusMetrics {
8787

8888
let prometheus = PrometheusMetricsBuilder::new(METRICS_NAMESPACE)
8989
.registry(registry)
90-
.endpoint("/metrics")
90+
.endpoint(metrics_path().as_str())
9191
.build()
9292
.expect("Prometheus initialization");
9393

0 commit comments

Comments
 (0)