Metric Reports
Milvaion includes an automated reporting system that generates metric reports about your job scheduling infrastructure. Reports are produced periodically by the ReporterWorker and stored in the database. You can view, filter, and manage them through the API and the Dashboard UI.
Overview
| Feature | Description |
|---|---|
| Automated Generation | ReporterWorker produces reports on a configurable schedule |
| 10 Metric Types | Job performance, worker throughput, workflow health, and more |
| Dashboard UI | Visual report cards with charts and drill-down detail pages |
| Data Retention | Built-in cleanup endpoint for removing old reports |
Architecture
┌──────────────┐ ┌────────────┐ ┌───────────────┐
│ PostgreSQL │──────▶│ Reporter │──────▶ │ PostgreSQL │
│ (Occurrences) │ read │ Worker │ write │(MetricReports)│
└──────────────┘ └────────────┘ └──────┬────────┘
│
┌────────▼────────┐
│ Milvaion API │
│ MetricReports │
│ Controller │
└────────┬────────┘
│
┌────────▼────────┐
│ Dashboard UI │
│ Report Pages │
└─────────────────┘
- ReporterWorker queries
JobOccurrences,ScheduledJobs, andWorkflowRuns - Computes aggregated metrics and writes a
MetricReportrecord with a JSONDatapayload - Milvaion API exposes CRUD endpoints through
MetricReportsController - Dashboard UI fetches the latest report per type and renders interactive charts
Metric Types
Milvaion provides 10 built-in metric report types, grouped into three categories:
Job Metrics
| Metric Type | Display Name | Description |
|---|---|---|
FailureRateTrend | Failure Rate Trend | Hourly failure rate percentage over the lookback period |
PercentileDurations | P50 / P95 / P99 Durations | Percentile-based execution duration distribution per job |
TopSlowJobs | Top Slow Jobs | Jobs with the highest average execution duration |
JobHealthScore | Job Health Score | Success rate and occurrence counts for each job |
CronScheduleVsActual | Cron Schedule vs Actual | Deviation between scheduled and actual execution times |
Worker Metrics
| Metric Type | Display Name | Description |
|---|---|---|
WorkerThroughput | Worker Throughput | Job count, success/failure breakdown, and average duration per worker |
WorkerUtilizationTrend | Worker Utilization Trend | Capacity vs actual utilization rate over time |
Workflow Metrics
| Metric Type | Display Name | Description |
|---|---|---|
WorkflowSuccessRate | Workflow Success Rate | Success, failure, partial, and cancelled rates per workflow |
WorkflowStepBottleneck | Workflow Step Bottleneck | Step-level performance analysis (avg/max duration, failure count) |
WorkflowDurationTrend | Workflow Duration Trend | Average workflow execution duration over time |
ReporterWorker Configuration
The ReporterWorker is a standalone Milvaion worker that generates all metric reports. Configure it in the worker's appsettings.json:
{
"Reporter": {
"DatabaseConnectionString": "Host=localhost;Database=MilvaionDb;Username=postgres;Password=...",
"ReportGeneration": {
"DataRetentionDays": 30,
"LookbackHours": 24,
"TopNLimit": 10,
"MaxScheduleDeviations": 500
}
}
}
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
DatabaseConnectionString | string | - | PostgreSQL connection string for reading occurrence data and writing reports |
DataRetentionDays | int | 30 | How many days of data to consider for report generation |
LookbackHours | int | 24 | Time window (in hours) for time-series reports |
TopNLimit | int | 10 | Maximum number of items in ranking reports (e.g., TopSlowJobs) |
MaxScheduleDeviations | int | 500 | Maximum deviation records for CronScheduleVsActual report |
Scheduling Report Jobs
Each report type is a separate job in the ReporterWorker. Schedule them through the Milvaion API like any other job:
{
"displayName": "Failure Rate Trend Report",
"selectedJobName": "FailureRateTrendReportJob",
"cronExpression": "0 */6 * * *",
"isActive": true
}
Recommended Schedules:
| Job | Cron Expression | Frequency |
|---|---|---|
FailureRateTrendReportJob | 0 */6 * * * | Every 6 hours |
PercentileDurationsReportJob | 0 */6 * * * | Every 6 hours |
TopSlowJobsReportJob | 0 0 * * * | Daily at midnight |
WorkerThroughputReportJob | 0 */6 * * * | Every 6 hours |
WorkerUtilizationTrendReportJob | 0 */6 * * * | Every 6 hours |
CronScheduleVsActualReportJob | 0 0 * * * | Daily at midnight |
JobHealthScoreReportJob | 0 0 * * * | Daily at midnight |
WorkflowSuccessRateReportJob | 0 0 * * * | Daily at midnight |
WorkflowStepBottleneckReportJob | 0 0 * * * | Daily at midnight |
WorkflowDurationTrendReportJob | 0 */6 * * * | Every 6 hours |
API Reference
All endpoints are served under api/v1.0/metricreports and require Manager user type authentication with the corresponding permissions.
List Reports
Returns a paginated and filterable list of metric reports.
Endpoint: PATCH /api/v1.0/metricreports
Permission: ScheduledJobManagement.List
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
pageNumber | int | No | Page number for pagination |
rowCount | int | No | Number of results per page (1–1000) |
metricType | string | No | Filter by metric type (e.g., FailureRateTrend) |
sorting | object | No | Sorting configuration |
Example:
curl -X PATCH https://your-domain/api/v1.0/metricreports \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"pageNumber": 1,
"rowCount": 20,
"metricType": "WorkerThroughput",
"sorting": {
"sortBy": "GeneratedAt",
"type": 1
}
}'
Response:
{
"isSuccess": true,
"statusCode": 200,
"totalDataCount": 42,
"data": [
{
"id": "01968a3b-...",
"metricType": "WorkerThroughput",
"displayName": "Worker Throughput",
"description": "Job count processed by each worker",
"data": "{\"workers\": [...]}",
"periodStartTime": "2026-06-01T00:00:00Z",
"periodEndTime": "2026-06-02T00:00:00Z",
"generatedAt": "2026-06-02T00:05:00Z",
"tags": "worker,throughput",
"creationDate": "2026-06-02T00:05:00Z"
}
]
}
Get Report Detail
Returns full details of a specific metric report by its unique identifier.
Endpoint: GET /api/v1.0/metricreports?Id={reportId}
Permission: ScheduledJobManagement.Detail
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
Id | Guid | Yes | Unique report identifier |
Example:
curl https://your-domain/api/v1.0/metricreports?Id=01968a3b-... \
-H "Authorization: Bearer <token>"
Response:
{
"isSuccess": true,
"statusCode": 200,
"data": {
"id": "01968a3b-...",
"metricType": "FailureRateTrend",
"displayName": "Failure Rate Trend",
"description": "Error rate changes over time",
"data": "{\"thresholdPercentage\": 5.0, \"dataPoints\": [...]}",
"periodStartTime": "2026-06-01T00:00:00Z",
"periodEndTime": "2026-06-02T00:00:00Z",
"generatedAt": "2026-06-02T00:05:00Z",
"tags": "failure,trend",
"creationDate": "2026-06-02T00:05:00Z",
"creatorUserName": "System"
}
}
Get Latest Report by Type
Returns the most recently generated report for the specified metric type.
Endpoint: GET /api/v1.0/metricreports/latest?MetricType={type}
Permission: ScheduledJobManagement.Detail
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
MetricType | string | Yes | Metric type key (e.g., JobHealthScore) |
Example:
curl https://your-domain/api/v1.0/metricreports/latest?MetricType=JobHealthScore \
-H "Authorization: Bearer <token>"
Response: Same structure as Get Report Detail.
Delete Report
Permanently deletes a single metric report by its unique identifier.
Endpoint: DELETE /api/v1.0/metricreports?Id={reportId}
Permission: ScheduledJobManagement.Delete
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
Id | Guid | Yes | Report identifier to delete |
Example:
curl -X DELETE https://your-domain/api/v1.0/metricreports?Id=01968a3b-... \
-H "Authorization: Bearer <token>"
Response:
{
"isSuccess": true,
"statusCode": 200,
"data": "01968a3b-..."
}
Delete Old Reports (Cleanup)
Bulk-deletes metric reports older than the specified number of days. Intended for periodic data retention cleanup.
Endpoint: DELETE /api/v1.0/metricreports/cleanup?OlderThanDays={days}
Permission: ScheduledJobManagement.Delete
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
OlderThanDays | int | Yes | Delete reports with GeneratedAt older than this many days (1–365) |
Example:
curl -X DELETE https://your-domain/api/v1.0/metricreports/cleanup?OlderThanDays=30 \
-H "Authorization: Bearer <token>"
Response:
{
"isSuccess": true,
"statusCode": 200,
"data": 15
}
The data field contains the number of deleted reports.
Report Data Schemas
Each metric type stores its data as a JSON payload in the Data field. Below are the schemas for each type.
FailureRateTrend
{
"thresholdPercentage": 5.0,
"dataPoints": [
{ "timestamp": "2026-06-01T10:00:00Z", "value": 2.5 },
{ "timestamp": "2026-06-01T11:00:00Z", "value": 3.1 }
]
}
PercentileDurations
{
"jobs": {
"EmailSenderJob": { "p50": 120.5, "p95": 450.2, "p99": 890.7 },
"DataSyncJob": { "p50": 80.3, "p95": 310.1, "p99": 620.4 }
}
}
TopSlowJobs
{
"jobs": [
{ "jobName": "HeavyReportJob", "averageDurationMs": 45200.5, "occurrenceCount": 12 },
{ "jobName": "DataMigrationJob", "averageDurationMs": 32100.3, "occurrenceCount": 8 }
]
}
WorkerThroughput
{
"workers": [
{
"workerId": "worker-1",
"jobCount": 150,
"successCount": 145,
"failureCount": 5,
"averageDurationMs": 1200.5
}
]
}
WorkerUtilizationTrend
{
"dataPoints": [
{
"timestamp": "2026-06-01T10:00:00Z",
"workerUtilization": {
"worker-1": 75.5,
"worker-2": 42.3
}
}
]
}
CronScheduleVsActual
{
"jobs": [
{
"occurrenceId": "01968a3b-...",
"jobId": "01968a2a-...",
"jobName": "HourlySync",
"scheduledTime": "2026-06-01T10:00:00Z",
"actualTime": "2026-06-01T10:00:12Z",
"deviationSeconds": 12.0
}
]
}
JobHealthScore
{
"jobs": [
{
"jobName": "EmailSenderJob",
"successRate": 98.5,
"totalOccurrences": 200,
"successCount": 197,
"failureCount": 3
}
]
}
WorkflowSuccessRate
{
"workflows": [
{
"workflowId": "01968a3b-...",
"workflowName": "OrderProcessing",
"successRate": 95.0,
"totalRuns": 100,
"completedCount": 95,
"failedCount": 3,
"partialCount": 1,
"cancelledCount": 1,
"avgDurationMs": 5400.0
}
]
}
WorkflowStepBottleneck
{
"workflows": [
{
"workflowId": "01968a3b-...",
"workflowName": "OrderProcessing",
"steps": [
{
"stepName": "ValidateOrder",
"avgDurationMs": 200.5,
"maxDurationMs": 1500.0,
"executionCount": 100,
"failureCount": 2,
"skippedCount": 0,
"retryCount": 1
}
]
}
]
}
WorkflowDurationTrend
{
"dataPoints": [
{
"timestamp": "2026-06-01T10:00:00Z",
"workflowAvgDurationMs": {
"OrderProcessing": 5200.0,
"DataPipeline": 12400.0
}
}
]
}
Dashboard UI
The Milvaion Dashboard includes a dedicated Reports section with two main views.
Report Dashboard
The report dashboard displays a card for each metric type showing:
- Metric name and icon with color-coded category
- Latest report timestamp (or "No data" if no report exists)
- Quick navigation — click a card to view the detailed report with charts
Report Detail Pages
Each metric type has a dedicated detail page with:
- Interactive charts — line charts for time-series data, bar charts for rankings, grouped bars for comparisons
- Data tables — tabular representation of report data with sorting
- Report metadata — generation time, period start/end, tags
- History navigation — browse previous reports of the same type
Cleanup Dialog
The dashboard includes a cleanup dialog accessible from the toolbar:
- Set the retention days threshold (default: 30)
- Click Delete to bulk-remove old reports
- Confirmation shows the number of deleted reports
Data Retention
Metric reports accumulate over time. Implement a retention strategy to manage storage:
Manual Cleanup
Use the cleanup API endpoint:
# Delete reports older than 30 days
curl -X DELETE https://your-domain/api/v1.0/metricreports/cleanup?OlderThanDays=30 \
-H "Authorization: Bearer <token>"
Automated Cleanup
Schedule a cleanup job in the MilvaionMaintenance worker or create a dedicated scheduled job that calls the cleanup endpoint periodically:
{
"displayName": "Metric Report Cleanup",
"description": "Delete metric reports older than 30 days",
"cronExpression": "0 3 * * 0",
"isActive": true
}
Recommended retention periods:
| Environment | Retention | Rationale |
|---|---|---|
| Development | 7 days | Minimal storage |
| Staging | 14 days | Enough for testing cycles |
| Production | 30–90 days | Balance between history and storage |
Database Schema
The MetricReports table stores all generated reports:
| Column | Type | Description |
|---|---|---|
Id | uuid (v7) | Primary key, time-ordered |
MetricType | varchar(100) | Report type key |
DisplayName | varchar(200) | Human-readable title |
Description | varchar(500) | What the report measures |
Data | jsonb | JSON-serialized report payload |
PeriodStartTime | timestamp | Start of the analysis window (UTC) |
PeriodEndTime | timestamp | End of the analysis window (UTC) |
GeneratedAt | timestamp | When the report was generated (UTC) |
Tags | varchar(500) | Comma-separated categorization tags |
CreationDate | timestamp | Audit: record creation time |
CreatorUserName | varchar | Audit: creator username |
Troubleshooting
No Reports Appearing
- Check ReporterWorker is running: Verify the worker container/process is up and connected
- Check job schedules: Ensure report jobs are scheduled and active in the Milvaion API
- Check database connectivity: ReporterWorker needs direct PostgreSQL access via
DatabaseConnectionString - Check logs: Look for
ReporterWorkerentries in your logging infrastructure (Seq, console)
Reports Show Empty Data
- Check lookback window: If
LookbackHoursis 24 but no jobs ran in the last 24 hours, data will be empty - Check occurrence data: Verify
JobOccurrencestable has data for the configured period - Check workflow data: Workflow reports require
WorkflowRunsdata
Cleanup Not Deleting Expected Reports
- Check
GeneratedAtvsCreationDate: Cleanup usesGeneratedAtfor the cutoff, notCreationDate - Verify
OlderThanDaysvalue: Must be between 1 and 365 - Check permissions: Cleanup requires
ScheduledJobManagement.Deletepermission
Dashboard Not Loading Reports
- Check API connectivity: Verify the UI can reach
api/v1.0/metricreports/latest - Check authentication: Reports require Manager-level authentication
- Check browser console: Look for network errors or CORS issues