mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-03 20:02:54 +00:00
feat: support 2+2 and /status/buildinfo (#3604)
* feat: implement buildinfo endpoint Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * refactor prom result struct Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add more integration test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * format toml file Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Update src/servers/src/http/prometheus_resp.rs --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -403,6 +403,22 @@ pub async fn test_prom_http_api(store_type: StorageType) {
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
|
||||
// instant query 1+1
|
||||
let res = client
|
||||
.get("/v1/prometheus/api/v1/query?query=1%2B1&time=1")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
let body = serde_json::from_str::<PrometheusJsonResponse>(&res.text().await).unwrap();
|
||||
assert_eq!(body.status, "success");
|
||||
assert_eq!(
|
||||
body.data,
|
||||
serde_json::from_value::<PrometheusResponse>(
|
||||
json!({"resultType":"scalar","result":[1.0,"2"]})
|
||||
)
|
||||
.unwrap()
|
||||
);
|
||||
|
||||
// range query
|
||||
let res = client
|
||||
.get("/v1/prometheus/api/v1/query_range?query=up&start=1&end=100&step=5")
|
||||
@@ -539,6 +555,15 @@ pub async fn test_prom_http_api(store_type: StorageType) {
|
||||
assert!(prom_resp.error.is_none());
|
||||
assert!(prom_resp.error_type.is_none());
|
||||
|
||||
// buildinfo
|
||||
let res = client
|
||||
.get("/v1/prometheus/api/v1/status/buildinfo")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
let body = serde_json::from_str::<PrometheusJsonResponse>(&res.text().await).unwrap();
|
||||
assert_eq!(body.status, "success");
|
||||
|
||||
guard.remove_all().await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user