Goal
The Grafana dashboard infra/grafana/dashboards/experiment-tracking.json references three metrics that no code emits:
experiment_dispatches_total{experiment, status}
experiment_cost_usd_total{experiment}
experiment_dispatch_duration_seconds_bucket{experiment}
Result: the dashboard is permanently empty. User has confirmed experiments is a planned feature. Wire the metrics so the dashboard works.
Tasks
1. Locate the experiment dispatch path
Experiments are not yet a first-class concept in the codebase. Likely entry points to check:
crates/orchestrator/src/scheduler/ — experiments may live alongside workflows
- Workflow metadata — check whether
WorkflowResponse has an experiment field
- Any prompt template variables that label dispatches with an experiment ID
If experiments don't exist yet as a concept: this issue may need to be re-scoped as "add experiment tracking" rather than just emitting the metrics.
2. Emit the three metrics
// On dispatch completion
metrics::counter!("experiment_dispatches_total",
"experiment" => experiment_id,
"status" => status_label, // "dispatched" | "failed"
).increment(1);
metrics::counter!("experiment_cost_usd_total",
"experiment" => experiment_id,
).increment_by(cost_usd);
metrics::histogram!("experiment_dispatch_duration_seconds",
"experiment" => experiment_id,
).record(duration_secs);
Cardinality note: experiment label is bounded by the number of distinct experiments — acceptable if experiments are limited (≤ 100s). If experiments can grow unbounded, consider hashing/bucketing.
3. Validate the dashboard
Open experiment-tracking.json in Grafana with Prometheus connected and confirm all panels render data.
Files Touched
crates/orchestrator/src/scheduler/runner.rs (or wherever dispatch happens)
- Possibly
crates/orchestrator/src/types.rs if experiment becomes a workflow field
Verification
- Run an experiment dispatch (mechanism TBD based on discovery in task 1)
curl localhost:17006/metrics | grep experiment_ shows the three metrics
- Grafana panels in
experiment-tracking.json show non-empty time series
Goal
The Grafana dashboard
infra/grafana/dashboards/experiment-tracking.jsonreferences three metrics that no code emits:experiment_dispatches_total{experiment, status}experiment_cost_usd_total{experiment}experiment_dispatch_duration_seconds_bucket{experiment}Result: the dashboard is permanently empty. User has confirmed experiments is a planned feature. Wire the metrics so the dashboard works.
Tasks
1. Locate the experiment dispatch path
Experiments are not yet a first-class concept in the codebase. Likely entry points to check:
crates/orchestrator/src/scheduler/— experiments may live alongside workflowsWorkflowResponsehas anexperimentfieldIf experiments don't exist yet as a concept: this issue may need to be re-scoped as "add experiment tracking" rather than just emitting the metrics.
2. Emit the three metrics
Cardinality note:
experimentlabel is bounded by the number of distinct experiments — acceptable if experiments are limited (≤ 100s). If experiments can grow unbounded, consider hashing/bucketing.3. Validate the dashboard
Open
experiment-tracking.jsonin Grafana with Prometheus connected and confirm all panels render data.Files Touched
crates/orchestrator/src/scheduler/runner.rs(or wherever dispatch happens)crates/orchestrator/src/types.rsifexperimentbecomes a workflow fieldVerification
curl localhost:17006/metrics | grep experiment_shows the three metricsexperiment-tracking.jsonshow non-empty time series