metrics.json to derive metrics from those events and display them on the monitoring dashboard.
Log a custom event
Uselog() from the framework to emit a structured event whenever a task is completed. Add this to the updateTask procedure:
source and type. Beyond that, you can include any fields you want — these become available for log filtering and metric dimensioning. Logs are searchable in the monitoring dashboard at /admin/monitoring/logs.
Define the metric
Add aTaskCompleted metric to metrics.json that counts every task_completed event, dimensioned by priority:
filtercontrols which log entries feed into this metric — here, only entries wheretypeis"task_completed"value: 1means each matching entry counts as one occurrencedimensionsdefines how the metric is sliced — theprioritydimension buckets the raw numeric priority into High, Medium, and Low
buckets to bound cardinality. Buckets can be numeric ranges ([min, max]) or exact string matches.
Add a chart
Add a chart to visualize task completions on the monitoring dashboard:/admin/monitoring/dashboard with a stacked bar chart showing task completions split by priority level. You can add more charts to the same tab by using the same tab value.
For production monitoring, dashboard configuration, and the observability API, see Monitoring. For the full metrics.json schema, default metrics, and chart options, see the Metrics reference.
