Skip to content

fix(telemetry): keep one metric stream per workload - #5324

Merged
dan-petty merged 6 commits into
mainfrom
fix/4697-keep-one-metric-stream-per-workload
Nov 13, 2026
Merged

dan-petty merged 6 commits into
mainfrom
fix/4697-keep-one-metric-stream-per-workload

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Prometheus kept one series for each job and instance, and every Service pod start and every runner Job pod began a new total at zero in it, so the counts that did not drop were lost. The metric Resource carried host.name, which is the pod name, and the collector keys a metric stream by every resource attribute. This change keeps one metric stream for each workload and adds the alert that fires if two streams write one Prometheus series again (#4697).

Closes #4697

Change: openspec/changes/archive/2026-11-13-4697-keep-one-metric-stream-per-workload/

@devops-cli-service
devops-cli-service Bot force-pushed the fix/4697-keep-one-metric-stream-per-workload branch from 3bb8e33 to 1e40555 Compare November 13, 2026 01:59
@devops-cli-service
devops-cli-service Bot force-pushed the fix/4697-keep-one-metric-stream-per-workload branch from b38bf66 to e55f303 Compare November 13, 2026 02:04
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Step Status Attempts Tokens in/out Last failing command
group 1 done 1 5130157/20839 pytest on base: tests/server/routes/test_k8s_roadmap_service.py, tests/telemetry/test_telemetry.py, tests/telemetry/test_telemetry_instruments.py
group 2 done 1 2530349/9926 -
group 3 done 1 3521954/20352 pytest on base: tests/prometheus/test_k8s_monitoring_alerting.py
group 4 done 1 1278833/6166 -
group 5 done 1 1021170/5452 -
  • scoped check pre-push: passed, 9 s
  • scoped check static: passed, 23 s
  • scoped check tests: passed, 47 s
  • scoped check tests: the changed files select more than 30 test modules, so only the changed test modules ran. The required checks of CI run the others
  • fail-to-pass of group 1: fails on the base commit. Tests that fail on the base commit: tests.server.routes.test_k8s_roadmap_service::test_every_pod_of_the_deployment_exports_its_metrics_under_one_series_identity, tests.telemetry.test_telemetry_instruments::test_counters_are_monotonic_deltas_from_the_host_not_the_process, tests.telemetry.test_telemetry::test_two_tracers_with_one_instance_send_equal_metric_resources, tests.telemetry.test_telemetry::test_a_span_resource_names_the_host_while_the_metric_resource_does_not.
  • verify of group 2: uv run devops ci test tests/config/test_k8s_devops_runtime.py tests/commands/k8s/test_k8s_devops_stack.py tests/k8s/test_k8s_cluster_job_api.py exits 0.
configfile: pyproject.toml
plugins: xdist-3.8.0, cov-7.1.0, asyncio-1.4.1.post1, hypothesis-6.170.15, syrupy-7.0.0, time-machine-3.6.0, split-0.11.0, mock-3.17.0, anyio-4.16.0, platformdirs-4.14.5, timeout-2.4.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
timeout: 600.0s
timeout method: signal
timeout func_only: False
collected 62 items

tests/commands/k8s/test_k8s_devops_stack.py ........                                                                                                                                                                                               [ 12%]
tests/config/test_k8s_devops_runtime.py ..................                                                                                                                                                                                         [ 41%]
tests/k8s/test_k8s_cluster_job_api.py ....................................                                                                                                                                                                         [100%]

=================================================================================================================== 62 passed in 1.63s ===================================================================================================================
Bytecode compiled 19316 files in 452ms
Bytecode compiled 19316 files in 486ms
/home/devops/.data/agent/worktrees/w-4697/.venv/lib/python3.14/site-packages/pytest_asyncio/plugin.py:300: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the "fixture" caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to "function" scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
Elapsed: 12s
  • fail-to-pass of group 3: fails on the base commit. Tests that fail on the base commit: tests.prometheus.test_k8s_monitoring_alerting::test_the_baseline_rule_set, tests.prometheus.test_k8s_monitoring_alerting::test_each_unit_tested_rule_fires_on_a_sample_and_stays_quiet_on_a_normal_series[metric_streams_tests], tests.prometheus.test_k8s_monitoring_alerting::test_the_promtool_files_of_a_group_test_every_alert_of_the_group[metric-streams].
  • verify of group 4: uv run devops ci test tests/prometheus/test_k8s_monitoring_alerting.py exits 0.
platform linux -- Python 3.14.10, pytest-9.2.0, pluggy-1.7.0
rootdir: /home/devops/.data/agent/worktrees/w-4697
configfile: pyproject.toml
plugins: xdist-3.8.0, cov-7.1.0, asyncio-1.4.1.post1, hypothesis-6.170.15, syrupy-7.0.0, time-machine-3.6.0, split-0.11.0, mock-3.17.0, anyio-4.16.0, platformdirs-4.14.5, timeout-2.4.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
timeout: 600.0s
timeout method: signal
timeout func_only: False
collected 96 items

tests/prometheus/test_k8s_monitoring_alerting.py ................................................................................................                                                                                                  [100%]

================================================================================================================== 96 passed in 18.63s ===================================================================================================================
Bytecode compiled 19316 files in 470ms
Bytecode compiled 19316 files in 455ms
/home/devops/.data/agent/worktrees/w-4697/.venv/lib/python3.14/site-packages/pytest_asyncio/plugin.py:300: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the "fixture" caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to "function" scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
Elapsed: 29s
  • verify of group 4: uv run devops ci docs exits 0.
\u2139 Quality gate root: /home/devops/.data/agent/worktrees/w-4697
\u2713 All documentation files are up to date.
Bytecode compiled 19316 files in 486ms
Bytecode compiled 19316 files in 490ms
Elapsed: 8.07s
Elapsed: 11s
  • verify of group 5: uv run devops ci docs exits 0.
\u2139 Quality gate root: /home/devops/.data/agent/worktrees/w-4697
\u2713 All documentation files are up to date.
Bytecode compiled 19316 files in 466ms
Bytecode compiled 19316 files in 453ms
Elapsed: 8.10s
Elapsed: 11s

@devops-cli-service devops-cli-service Bot added type/bug Type bug: the code does not do what it must scope/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger labels Nov 13, 2026
@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 13, 2026 02:11
@dan-petty
dan-petty merged commit 0165669 into main Nov 13, 2026
28 checks passed
@dan-petty
dan-petty deleted the fix/4697-keep-one-metric-stream-per-workload branch November 13, 2026 02:13
dan-petty pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.125.3](v0.125.2...v0.125.3)
(2026-11-13)


### Bug Fixes

* **k8s:** deploy-stack fetches a private Application repo
([#5331](#5331))
([b0e7c5d](b0e7c5d))
* **telemetry:** keep one metric stream per workload
([#5324](#5324))
([0165669](0165669))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(telemetry): keep one metric stream per workload

1 participant