fix: fix for grafana querying prometheus endpoint (#713)

Make change to prometheus endpoints so grafana queries can succeed.
This commit is contained in:
Prabhat Sharma
2023-05-11 06:52:00 +05:30
committed by GitHub
parent f20c9805bb
commit 3843631ade
3 changed files with 14 additions and 14 deletions
+7 -7
View File
@@ -38,7 +38,7 @@ use crate::service::promql;
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[post("/{org_id}/prometheus/v1/write")]
#[post("/{org_id}/prometheus/api/v1/write")]
pub async fn remote_write(
org_id: web::Path<String>,
thread_id: web::Data<usize>,
@@ -100,7 +100,7 @@ pub async fn remote_write(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/query")]
#[get("/{org_id}/prometheus/api/v1/query")]
pub async fn query(
org_id: web::Path<String>,
query: web::Query<meta::prom::RequestQuery>,
@@ -209,7 +209,7 @@ pub async fn query(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/query_range")]
#[get("/{org_id}/prometheus/api/v1/query_range")]
pub async fn query_range(
org_id: web::Path<String>,
range_query: web::Query<meta::prom::RequestRangeQuery>,
@@ -330,7 +330,7 @@ pub async fn query_range(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/metadata")]
#[get("/{org_id}/prometheus/api/v1/metadata")]
pub async fn metadata(
org_id: web::Path<String>,
req: web::Query<meta::prom::RequestMetadata>,
@@ -385,7 +385,7 @@ pub async fn metadata(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/series")]
#[get("/{org_id}/prometheus/api/v1/series")]
pub async fn series(
org_id: web::Path<String>,
series: web::Query<meta::prom::RequestSeries>,
@@ -440,7 +440,7 @@ pub async fn series(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/labels")]
#[get("/{org_id}/prometheus/api/v1/labels")]
pub async fn labels(
org_id: web::Path<String>,
labels: web::Query<meta::prom::RequestLabels>,
@@ -477,7 +477,7 @@ pub async fn labels(
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse),
)
)]
#[get("/{org_id}/prometheus/v1/label/{label_name}/values")]
#[get("/{org_id}/prometheus/api/v1/label/{label_name}/values")]
pub async fn values(
path: web::Path<(String, String)>,
values: web::Query<meta::prom::RequestValues>,
+6 -6
View File
@@ -25,12 +25,12 @@ const QUERIER_ROUTES: [&str; 9] = [
"/_search",
"/_around",
"/_values",
"/prometheus/v1/series",
"/prometheus/v1/query_range",
"/prometheus/v1/query",
"/prometheus/v1/metadata",
"/prometheus/v1/labels",
"/prometheus/v1/label/",
"/prometheus/api/v1/series",
"/prometheus/api/v1/query_range",
"/prometheus/api/v1/query",
"/prometheus/api/v1/metadata",
"/prometheus/api/v1/labels",
"/prometheus/api/v1/label/",
];
#[inline]
+1 -1
View File
@@ -963,7 +963,7 @@ mod tests {
)
.await;
let req = test::TestRequest::post()
.uri(&format!("/api/{}/prometheus/v1/write", "e2e"))
.uri(&format!("/api/{}/prometheus/api/v1/write", "e2e"))
.insert_header(("X-Prometheus-Remote-Write-Version", "0.1.0"))
.insert_header(("Content-Encoding", "snappy"))
.insert_header(("Content-Type", "application/x-protobuf"))