Skip to content

Comments

Fix Prometheus job execution counters by removing duplicate metric-family emission#1925

Open
Copilot wants to merge 2 commits intomainfrom
copilot/check-pr-correctness
Open

Fix Prometheus job execution counters by removing duplicate metric-family emission#1925
Copilot wants to merge 2 commits intomainfrom
copilot/check-pr-correctness

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

Proposed changes

PR #1885 attempted to expose job execution success/failure counters in /metrics, but the counters were still unreliable due to duplicate emission through two metric systems under the same metric names.
This update makes Prometheus export deterministic by emitting these counters through a single collector path.

  • Metric registration

    • Added native Prometheus counters in dkron/job_metrics.go:
      • dkron_job_executions_succeeded_total{job_name=...}
      • dkron_job_executions_failed_total{job_name=...}
  • Execution-path wiring

    • Updated Store.SetExecutionDone to increment the native Prometheus counters for success/failure outcomes.
    • Removed go-metrics emission for these two metric names to prevent duplicate metric-family conflicts during gather/scrape.
  • Focused regression coverage

    • Added TestSetExecutionDonePrometheusMetrics in dkron/store_test.go to assert both counters increment correctly per job_name label.
if pbe.Success {
    JobExecutionsSucceededTotal.WithLabelValues(execution.JobName).Inc()
} else {
    JobExecutionsFailedTotal.WithLabelValues(execution.JobName).Inc()
}

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 127.0.0.10
    • Triggering command: /tmp/go-build1174015694/b1335/dkron.test /tmp/go-build1174015694/b1335/dkron.test -test.testlogfile=/tmp/go-build1174015694/b1335/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ternal/protocompile/internal/cases/cases.go ternal/protocompile/internal/cases/words.go (packet block)
  • 127.0.0.11
    • Triggering command: /tmp/go-build1174015694/b1335/dkron.test /tmp/go-build1174015694/b1335/dkron.test -test.testlogfile=/tmp/go-build1174015694/b1335/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ternal/protocompile/internal/cases/cases.go ternal/protocompile/internal/cases/words.go (packet block)
  • 127.0.0.13
    • Triggering command: /tmp/go-build1174015694/b1335/dkron.test /tmp/go-build1174015694/b1335/dkron.test -test.testlogfile=/tmp/go-build1174015694/b1335/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ternal/protocompile/internal/cases/cases.go ternal/protocompile/internal/cases/words.go (packet block)
  • 127.0.0.14
    • Triggering command: /tmp/go-build1174015694/b1335/dkron.test /tmp/go-build1174015694/b1335/dkron.test -test.testlogfile=/tmp/go-build1174015694/b1335/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ternal/protocompile/internal/cases/cases.go ternal/protocompile/internal/cases/words.go (packet block)
  • client.badssl.com
    • Triggering command: /tmp/go-build1174015694/b1349/http.test /tmp/go-build1174015694/b1349/http.test -test.testlogfile=/tmp/go-build1174015694/b1349/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 4015694/b1025/_p-errorsas pkg/mod/k8s.io/a-ifaceassert ux_amd64/vet -p .io/otel/exporte-atomic -lang=go1.23 ux_amd64/vet (dns block)
  • self-signed.badssl.com
    • Triggering command: /tmp/go-build1174015694/b1349/http.test /tmp/go-build1174015694/b1349/http.test -test.testlogfile=/tmp/go-build1174015694/b1349/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 4015694/b1025/_p-errorsas pkg/mod/k8s.io/a-ifaceassert ux_amd64/vet -p .io/otel/exporte-atomic -lang=go1.23 ux_amd64/vet (dns block)
  • untrusted-root.badssl.com
    • Triggering command: /tmp/go-build1174015694/b1349/http.test /tmp/go-build1174015694/b1349/http.test -test.testlogfile=/tmp/go-build1174015694/b1349/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 4015694/b1025/_p-errorsas pkg/mod/k8s.io/a-ifaceassert ux_amd64/vet -p .io/otel/exporte-atomic -lang=go1.23 ux_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: vcastellm <47026+vcastellm@users.noreply.github.com>
Copilot AI changed the title [WIP] Check if PR is correct and implement fix if needed Fix Prometheus job execution counters by removing duplicate metric-family emission Feb 15, 2026
Copilot AI requested a review from vcastellm February 15, 2026 17:58
@vcastellm vcastellm marked this pull request as ready for review February 15, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants