Step 18 of 21 · 4 minutes

Metrics That Matter

The Scenario

DevOps needs to set up monitoring and alerting for background jobs: How many jobs are we processing per minute? What's the failure rate? Are queues backing up?

They need metrics that feed into Prometheus and Grafana (or some competing observability platform).

The Challenge

How do we expose job metrics for monitoring and alerting systems?

The Solution

JobRunr Pro integrates with Micrometer to expose metrics:


# In application.properties
jobrunr.jobs.metrics.enabled=true
jobrunr.jobs.metrics.micrometer-timers.enabled=true

Available metrics include:
  • jobrunr_jobs_by_state — Jobs per state (ENQUEUED, PROCESSING, etc.)
  • jobrunr_jobs_in_progress — Jobs in progress
  • jobrunr_jobs_runs_* — Jobs execution times
  • jobrunr_background_job_server_* — Server health metrics

Read the documentation →

Try It Yourself

Open Prometheus and query JobRunr metrics:

http://localhost:9090

Try: jobrunr_jobs_by_state or rate(jobrunr_jobs_in_progress_seconds_count[5m])
You need to log in to perform write operations. You can still view the code solution and dashboard.
Prometheus is not available in this live demo. Run the demo locally to explore the metrics.