mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-08 06:12:55 +00:00
feat: support prometheus format_query endpoint (#2731)
* feat: support prometheus format_query endpoint Signed-off-by: tison <wander4096@gmail.com> * add test Signed-off-by: tison <wander4096@gmail.com> --------- Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
@@ -341,6 +341,17 @@ pub async fn test_prom_http_api(store_type: StorageType) {
|
||||
let (app, mut guard) = setup_test_prom_app_with_frontend(store_type, "promql_api").await;
|
||||
let client = TestClient::new(app);
|
||||
|
||||
// format_query
|
||||
let res = client
|
||||
.get("/v1/prometheus/api/v1/format_query?query=foo/bar")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
assert_eq!(
|
||||
res.text().await.as_str(),
|
||||
r#"{"status":"success","data":"foo / bar"}"#
|
||||
);
|
||||
|
||||
// instant query
|
||||
let res = client
|
||||
.get("/v1/prometheus/api/v1/query?query=up&time=1")
|
||||
|
||||
Reference in New Issue
Block a user