mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
feat: dynamic enable or disable trace (#6609)
* wip Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * set `TRACE_RELOAD_HANDLE` Signed-off-by: Zhenchi <zhongzc_arch@outlook.com> * wrap http api Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update dependencies Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * type alias and unwrap_or_else Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * better error handling Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * simplify Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * lazy initialize tracer Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * integration test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: Zhenchi <zhongzc_arch@outlook.com> Co-authored-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
@@ -101,6 +101,7 @@ macro_rules! http_tests {
|
||||
test_health_api,
|
||||
test_status_api,
|
||||
test_config_api,
|
||||
test_dynamic_tracer_toggle,
|
||||
test_dashboard_path,
|
||||
test_prometheus_remote_write,
|
||||
test_prometheus_remote_special_labels,
|
||||
@@ -1627,6 +1628,35 @@ fn drop_lines_with_inconsistent_results(input: String) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn test_dynamic_tracer_toggle(store_type: StorageType) {
|
||||
common_telemetry::init_default_ut_logging();
|
||||
|
||||
let (app, mut guard) = setup_test_http_app(store_type, "test_dynamic_tracer_toggle").await;
|
||||
let client = TestClient::new(app).await;
|
||||
|
||||
let disable_resp = client
|
||||
.post("/debug/enable_trace")
|
||||
.body("false")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(disable_resp.status(), StatusCode::OK);
|
||||
assert_eq!(disable_resp.text().await, "trace disabled");
|
||||
|
||||
let enable_resp = client.post("/debug/enable_trace").body("true").send().await;
|
||||
assert_eq!(enable_resp.status(), StatusCode::OK);
|
||||
assert_eq!(enable_resp.text().await, "trace enabled");
|
||||
|
||||
let cleanup_resp = client
|
||||
.post("/debug/enable_trace")
|
||||
.body("false")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(cleanup_resp.status(), StatusCode::OK);
|
||||
assert_eq!(cleanup_resp.text().await, "trace disabled");
|
||||
|
||||
guard.remove_all().await;
|
||||
}
|
||||
|
||||
#[cfg(feature = "dashboard")]
|
||||
pub async fn test_dashboard_path(store_type: StorageType) {
|
||||
common_telemetry::init_default_ut_logging();
|
||||
|
||||
Reference in New Issue
Block a user