Skip to content

brokkr-broker::api::v1::diagnostics

Rust

Diagnostics API endpoints.

This module provides routes and handlers for on-demand diagnostic requests. Operators can request diagnostics for specific deployment objects, and agents pick up and execute these requests, returning detailed diagnostic data.

pub

Derives: Debug, Clone, Serialize, Deserialize, utoipa::ToSchema

Request body for creating a diagnostic request.

Name Type Description
agent_id Uuid The agent that should handle this request.
requested_by Option<String> Who is requesting the diagnostics (optional).
retention_minutes Option<i64> How long the request should be retained in minutes (default 60, max 1440).

pub

Derives: Debug, Clone, Serialize, Deserialize, utoipa::ToSchema

Response containing a diagnostic request with optional result.

Name Type Description
request DiagnosticRequest The diagnostic request.
result Option<DiagnosticResult> The diagnostic result, if completed.

pub

Derives: Debug, Clone, Serialize, Deserialize, utoipa::ToSchema

Request body for submitting diagnostic results.

Name Type Description
pod_statuses String JSON-encoded pod statuses.
events String JSON-encoded Kubernetes events.
log_tails Option<String> JSON-encoded log tails (optional).
collected_at DateTime<Utc> When the diagnostics were collected.

pub

fn routes() -> Router<DAL>

Creates and returns the router for diagnostic endpoints.

Source
pub fn routes() -> Router<DAL> {
info!("Setting up diagnostic routes");
Router::new()
.route(
"/deployment-objects/:id/diagnostics",
post(create_diagnostic_request),
)
.route("/diagnostics/:id", get(get_diagnostic))
.route(
"/agents/:id/diagnostics/pending",
get(get_pending_diagnostics),
)
.route("/diagnostics/:id/claim", post(claim_diagnostic))
.route("/diagnostics/:id/result", post(submit_diagnostic_result))
}