Skip to main content
Version: 1.6

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​

FeatureDescription
Automated GenerationReporterWorker produces reports on a configurable schedule
10 Metric TypesJob performance, worker throughput, workflow health, and more
Dashboard UIVisual report cards with charts and drill-down detail pages
Data RetentionBuilt-in cleanup endpoint for removing old reports

Architecture​

┌──────────────┐         ┌────────────┐         ┌───────────────┐
│ PostgreSQL │──────▶│ Reporter │──────▶ │ PostgreSQL │
│ (Occurrences) │ read │ Worker │ write │(MetricReports)│
└──────────────┘ └────────────┘ └──────┬────────┘
│
┌────────▼────────┐
│ Milvaion API │
│ MetricReports │
│ Controller │
└────────┬────────┘
│
┌────────▼────────┐
│ Dashboard UI │
│ Report Pages │
└─────────────────┘
  1. ReporterWorker queries JobOccurrences, ScheduledJobs, and WorkflowRuns
  2. Computes aggregated metrics and writes a MetricReport record with a JSON Data payload
  3. Milvaion API exposes CRUD endpoints through MetricReportsController
  4. 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 TypeDisplay NameDescription
FailureRateTrendFailure Rate TrendHourly failure rate percentage over the lookback period
PercentileDurationsP50 / P95 / P99 DurationsPercentile-based execution duration distribution per job
TopSlowJobsTop Slow JobsJobs with the highest average execution duration
JobHealthScoreJob Health ScoreSuccess rate and occurrence counts for each job
CronScheduleVsActualCron Schedule vs ActualDeviation between scheduled and actual execution times

Worker Metrics​

Metric TypeDisplay NameDescription
WorkerThroughputWorker ThroughputJob count, success/failure breakdown, and average duration per worker
WorkerUtilizationTrendWorker Utilization TrendCapacity vs actual utilization rate over time

Workflow Metrics​

Metric TypeDisplay NameDescription
WorkflowSuccessRateWorkflow Success RateSuccess, failure, partial, and cancelled rates per workflow
WorkflowStepBottleneckWorkflow Step BottleneckStep-level performance analysis (avg/max duration, failure count)
WorkflowDurationTrendWorkflow Duration TrendAverage 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​

OptionTypeDefaultDescription
DatabaseConnectionStringstring-PostgreSQL connection string for reading occurrence data and writing reports
DataRetentionDaysint30How many days of data to consider for report generation
LookbackHoursint24Time window (in hours) for time-series reports
TopNLimitint10Maximum number of items in ranking reports (e.g., TopSlowJobs)
MaxScheduleDeviationsint500Maximum 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:

JobCron ExpressionFrequency
FailureRateTrendReportJob0 */6 * * *Every 6 hours
PercentileDurationsReportJob0 */6 * * *Every 6 hours
TopSlowJobsReportJob0 0 * * *Daily at midnight
WorkerThroughputReportJob0 */6 * * *Every 6 hours
WorkerUtilizationTrendReportJob0 */6 * * *Every 6 hours
CronScheduleVsActualReportJob0 0 * * *Daily at midnight
JobHealthScoreReportJob0 0 * * *Daily at midnight
WorkflowSuccessRateReportJob0 0 * * *Daily at midnight
WorkflowStepBottleneckReportJob0 0 * * *Daily at midnight
WorkflowDurationTrendReportJob0 */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:

FieldTypeRequiredDescription
pageNumberintNoPage number for pagination
rowCountintNoNumber of results per page (1–1000)
metricTypestringNoFilter by metric type (e.g., FailureRateTrend)
sortingobjectNoSorting 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:

ParameterTypeRequiredDescription
IdGuidYesUnique 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:

ParameterTypeRequiredDescription
MetricTypestringYesMetric 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:

ParameterTypeRequiredDescription
IdGuidYesReport 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:

ParameterTypeRequiredDescription
OlderThanDaysintYesDelete 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:

  1. Set the retention days threshold (default: 30)
  2. Click Delete to bulk-remove old reports
  3. 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:

EnvironmentRetentionRationale
Development7 daysMinimal storage
Staging14 daysEnough for testing cycles
Production30–90 daysBalance between history and storage

Database Schema​

The MetricReports table stores all generated reports:

ColumnTypeDescription
Iduuid (v7)Primary key, time-ordered
MetricTypevarchar(100)Report type key
DisplayNamevarchar(200)Human-readable title
Descriptionvarchar(500)What the report measures
DatajsonbJSON-serialized report payload
PeriodStartTimetimestampStart of the analysis window (UTC)
PeriodEndTimetimestampEnd of the analysis window (UTC)
GeneratedAttimestampWhen the report was generated (UTC)
Tagsvarchar(500)Comma-separated categorization tags
CreationDatetimestampAudit: record creation time
CreatorUserNamevarcharAudit: creator username

Troubleshooting​

No Reports Appearing​

  1. Check ReporterWorker is running: Verify the worker container/process is up and connected
  2. Check job schedules: Ensure report jobs are scheduled and active in the Milvaion API
  3. Check database connectivity: ReporterWorker needs direct PostgreSQL access via DatabaseConnectionString
  4. Check logs: Look for ReporterWorker entries in your logging infrastructure (Seq, console)

Reports Show Empty Data​

  1. Check lookback window: If LookbackHours is 24 but no jobs ran in the last 24 hours, data will be empty
  2. Check occurrence data: Verify JobOccurrences table has data for the configured period
  3. Check workflow data: Workflow reports require WorkflowRuns data

Cleanup Not Deleting Expected Reports​

  1. Check GeneratedAt vs CreationDate: Cleanup uses GeneratedAt for the cutoff, not CreationDate
  2. Verify OlderThanDays value: Must be between 1 and 365
  3. Check permissions: Cleanup requires ScheduledJobManagement.Delete permission

Dashboard Not Loading Reports​

  1. Check API connectivity: Verify the UI can reach api/v1.0/metricreports/latest
  2. Check authentication: Reports require Manager-level authentication
  3. Check browser console: Look for network errors or CORS issues