prometheus_metrics

command
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 9 Imported by: 0

README

Prometheus Metrics Example

This example shows how to:

  • Wire core.TaskSchedulerConfig.Metrics to the Prometheus exporter.
  • Poll runner/pool Stats() into Prometheus gauges.
  • Expose /metrics for scraping.

Run

go run ./examples/prometheus_metrics

While it is running, scrape metrics:

curl -s http://127.0.0.1:2112/metrics | grep '^taskrunner_'

The demo keeps the server alive for about 2 seconds.

What to look at

  • taskrunner_task_duration_seconds: task execution latency histogram.
  • taskrunner_task_panic_total: count of panics during task execution.
  • taskrunner_task_rejected_total: count of rejected tasks.
  • taskrunner_queue_depth: scheduler/runner queue depth.
  • taskrunner_runner_pending: pending tasks from RunnerStats.
  • taskrunner_runner_running: running tasks from RunnerStats.
  • taskrunner_pool_queued: queued tasks from PoolStats.
  • taskrunner_pool_active: active tasks from PoolStats.
  • taskrunner_pool_delayed: delayed tasks from PoolStats.

PromQL examples

sum(rate(taskrunner_task_duration_seconds_count[5m])) by (runner)
max(taskrunner_queue_depth) by (runner)
taskrunner_pool_active{pool="metrics-pool"}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL