Skip to content
Edit this page

Prometheus

Bellhop emits its metrics through a .NET Meter named Bellhop and needs no exporter of its own. With the standard OpenTelemetry SDK and its Prometheus exporter, the setup is two lines of application code:

dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore --prerelease

Where you register services:

builder.Services.AddOpenTelemetry().WithMetrics(metrics => metrics.AddMeter("Bellhop").AddPrometheusExporter());

and once the application is built:

app.MapPrometheusScrapingEndpoint();

Prometheus then scrapes /metrics. The endpoint is anonymous and shows your job names, queues and volumes: serve it on an internal port (.RequireHost("*:9464") on the mapping, with Kestrel listening there too) or restrict it in your network. The exporter is OpenTelemetry's own package, still published as a beta; Bellhop has no Prometheus-specific package. If your application already sets up OpenTelemetry metrics, add .AddMeter("Bellhop") to it instead.

What it exports

Metric What it measures, on the node that reports it
bellhop_jobs_enqueued_total jobs created
bellhop_jobs_started_total attempts started
bellhop_jobs_succeeded_total jobs that succeeded
bellhop_jobs_failed_total attempts that failed
bellhop_jobs_retried_total failed attempts that will be retried
bellhop_jobs_dead_lettered_total jobs dead-lettered
bellhop_jobs_interrupted_total attempts that ended without an outcome: a lease recovered after its node was lost, or a job handed back at shutdown
bellhop_jobs_removed_total finished jobs removed by retention cleanup
bellhop_jobs_execution_duration_seconds how long attempts ran (histogram)
bellhop_jobs_scheduling_lag_seconds how long claimed jobs had waited, enqueued, by the store's clock (histogram)
bellhop_queue_depth enqueued jobs per queue, read from the store
bellhop_workers_active jobs this node's worker is running now
bellhop_notifications_failed_total notification deliveries this node marked failed, by rule and channel (bellhop_notification_rule, bellhop_notification_channel)

Job metrics carry the queue as messaging_destination_name and the job's name as bellhop_job_name.

Things to know

  • Aggregate queue depth with max, not sum. Every node reports the same count from the store, so sum multiplies it by the number of nodes: max by (messaging_destination_name) (bellhop_queue_depth).
  • Queue depth is read from the store at most once per PollInterval per node, and only while something scrapes the node, so a scrape shows the depths of the previous read. On PostgreSQL the read counts the enqueued rows, so it costs more as the backlog grows.
  • Labels are the queue and the job name, so the number of series grows with your queues and job types. Do not name queues from user input.