Fix Prometheus job execution counters by removing duplicate metric-family emission#1925
Open
Fix Prometheus job execution counters by removing duplicate metric-family emission#1925
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
dkron/job_metrics.go:dkron_job_executions_succeeded_total{job_name=...}dkron_job_executions_failed_total{job_name=...}Execution-path wiring
Store.SetExecutionDoneto increment the native Prometheus counters for success/failure outcomes.go-metricsemission for these two metric names to prevent duplicate metric-family conflicts during gather/scrape.Focused regression coverage
TestSetExecutionDonePrometheusMetricsindkron/store_test.goto assert both counters increment correctly perjob_namelabel.Types of changes
What types of changes does your code introduce?
Put an
xin the boxes that applyWarning
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/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/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/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/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/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/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/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.