Merge branch 'worktree-agent-ab342356b0191d35f'
# Conflicts: # src/engine.rs
This commit is contained in:
+13
-1
@@ -102,7 +102,7 @@ pub fn router(
|
||||
.route("/api/logs", get(get_logs))
|
||||
.route("/api/timeline", get(get_timeline))
|
||||
.route("/api/stats", get(get_stats))
|
||||
.route("/api/params", post(declare_param))
|
||||
.route("/api/params", get(list_params).post(declare_param))
|
||||
.route("/api/metrics", get(list_metrics).post(declare_metric))
|
||||
.route("/api/metrics/{name}", get(get_metric_bucket_values))
|
||||
.route("/api/query", get(run_promql_query))
|
||||
@@ -153,6 +153,18 @@ async fn get_stats(State(state): State<ApiState>) -> impl IntoResponse {
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /api/params` — lists all declared params (name, regex, capture
|
||||
/// group, kind) as `Vec<ParamDeclarationDto>`. Mirrors `list_metrics` below
|
||||
/// (ticket 015 needed this for LogPreview's column picker; ticket 004 only
|
||||
/// exposed the equivalent for metrics).
|
||||
async fn list_params(State(state): State<ApiState>) -> impl IntoResponse {
|
||||
match ask(&state.engine, EngineQuery::ParamDeclarations).await {
|
||||
Ok(EngineResponse::ParamDeclarations(declarations)) => Json(declarations).into_response(),
|
||||
Ok(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
||||
Err(status) => status.into_response(),
|
||||
}
|
||||
}
|
||||
|
||||
/// `POST /api/params` — declares a param. Body mirrors `DeclareParamRequest`:
|
||||
/// `{ "name": "...", "message_match_regex": "...", "capture_group": "...",
|
||||
/// "kind": "string" | "number" | "timestamp" }`. On success, also persists
|
||||
|
||||
Reference in New Issue
Block a user