The dashboard generation is completely automatic. You don't need to configure metrics or dashboard layouts manually.
npm run generate
# Choose "service"
# Enter service name: "User"
# Choose operations: validateInput, fetchUser, enrichDatanpm run generate:dashboardsThat's it! The generator will:
- ✅ Scan your orchestrator file (
CreateUserOrchestrator) - ✅ Extract the service name from the class name
- ✅ Extract operation names from
getPipeline() - ✅ Generate a beautiful Grafana dashboard automatically
4 Stat Cards:
- Avg Response Time
- Success Rate
- P95 Latency
- Avg Operations/min
Stacked Area Chart (Timeseries):
- Shows latency breakdown per operation over time
- Smooth line interpolation with 70% fill opacity
- Tooltip always shows ALL operations (no disappearing!)
- Legend on right with mean/max values
- Reveals performance trends and patterns
The generator creates queries automatically:
# Pipeline duration
orchestrator_pipeline_duration_ms{service="CreateUserOrchestrator"}
# Stage latency (per operation)
orchestrator_stage_latency_ms{service="CreateUserOrchestrator",stage="validate-input"}
orchestrator_stage_latency_ms{service="CreateUserOrchestrator",stage="fetch-user"}
orchestrator_stage_latency_ms{service="CreateUserOrchestrator",stage="enrich-data"}
No manual configuration needed! The metrics are automatically recorded by BaseOrchestrator.
export class CreateUserOrchestrator extends BaseOrchestrator<...> {
constructor() {
super({
name: 'CreateUserOrchestrator', // ← Used for service label
enableMetrics: true, // ← Enables automatic metrics
});
}
protected getPipeline() {
return [
{
name: 'validate-input', // ← Used for stage label
operation: validateInput,
},
{
name: 'fetch-user', // ← Used for stage label
operation: fetchUser,
},
{
name: 'enrich-data', // ← Used for stage label
operation: enrichData,
},
];
}
}When enableMetrics: true, BaseOrchestrator records:
// Pipeline-level metrics
OrchestratorMetrics.pipelineDuration.observe(
{ service: 'CreateUserOrchestrator', status: 'success' },
duration
);
// Stage-level metrics
OrchestratorMetrics.stageLatency.observe(
{ service: 'CreateUserOrchestrator', stage: 'validate-input' },
stageDuration
);// Scans orchestrator file
const className = 'CreateUserOrchestrator';
const serviceName = className; // Full name for queries
// Extracts from getPipeline()
const stages = [
{ name: 'validate-input', displayName: 'Validate Input' },
{ name: 'fetch-user', displayName: 'Fetch User' },
{ name: 'enrich-data', displayName: 'Enrich Data' },
];
// Generates perfect dashboard with correct queries!DriftOS: Requires manual metricName per operation
{
name: 'fetchUser',
metricName: 'user_fetch_user_ms', // ← Manual configuration
fn: ops.fetchUser
}Starter: Completely automatic with generic metrics
{
name: 'fetch-user', // ← This is ALL you need!
operation: fetchUser,
}Generic metrics with labels are:
- ✅ More consistent
- ✅ Easier to query
- ✅ Zero configuration
- ✅ Impossible to have mismatches
- Generate service:
npm run generate - Implement operations: Add your business logic
- Generate dashboards:
npm run generate:dashboards - Done! Dashboard automatically shows all metrics
No metric configuration. No dashboard tweaking. Just works! ✨
// 1. Add operation to pipeline
{
name: 'sendNotification',
metricName: 'user_send_notification_ms', // ← Remember to add this!
operation: sendNotification
}
// 2. Update dashboard JSON manually
// 3. Make sure metricName matches everywhere
// 4. Hope you didn't make a typo// 1. Add operation to pipeline
{
name: 'send-notification', // ← That's it!
operation: sendNotification
}
// 2. Run: npm run generate:dashboards
// 3. Done! Dashboard updated automatically ✅- Start services:
make up - Start dev server:
make dev - Generate metrics:
make test-api - Open Grafana: http://localhost:3001 (admin/admin)
- Dashboards → Browse → Your Service Performance
All metrics appear automatically! 🎉
Generated dashboards update every 10 seconds in Grafana.