Skip to content

[chore] Upgrade prometheus and k8s dependencies#43890

Merged
dmitryax merged 5 commits intoopen-telemetry:mainfrom
dmitryax:upgrade-prometheus-v0.307.1
Oct 31, 2025
Merged

[chore] Upgrade prometheus and k8s dependencies#43890
dmitryax merged 5 commits intoopen-telemetry:mainfrom
dmitryax:upgrade-prometheus-v0.307.1

Conversation

@dmitryax
Copy link
Member

@dmitryax dmitryax commented Oct 30, 2025

Both k8s and prometheus libraries have to be updated because they depend on each other and both have breaking changes.

The following files changed to adopt to the API breaking changes:

I haven't touched any usages of deprecated k8s API to keep the changeset small. Created a separate issue for that instead #43891

Some prometheus tests are failing due to behavioral change in prometheus library. I skipped them for now and reported #43893

@dmitryax dmitryax force-pushed the upgrade-prometheus-v0.307.1 branch 5 times, most recently from c200374 to 373b138 Compare October 30, 2025 06:23
@dmitryax dmitryax changed the title [chore] Upgrade prometheus and k8s depenedencies [chore] Upgrade prometheus and k8s dependencies Oct 30, 2025
@songy23
Copy link
Member

songy23 commented Oct 30, 2025

This may actually need a changelog - defer to the code owners

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dmitryax, overall it looks good, just one question

@songy23
Copy link
Member

songy23 commented Oct 30, 2025

breaks k8sclient TestGetShutdown on Windows https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/18932723111/job/54091848951?pr=43890 seems a consistent failure

@songy23 songy23 added the Run Windows Enable running windows test on a PR label Oct 30, 2025
@dmitryax dmitryax merged commit a21ba8b into open-telemetry:main Oct 31, 2025
226 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 31, 2025
@dmitryax dmitryax deleted the upgrade-prometheus-v0.307.1 branch October 31, 2025 04:16
krajorama added a commit to krajorama/opentelemetry-collector-contrib that referenced this pull request Oct 31, 2025
In the dependency upgrade open-telemetry#43890 there was the PR
prometheus/prometheus#16429 which
changed the provisions for staleness tracking. Now the code only
does the tracking if the series was successfully appended in storage.
This is indicated by a non zero storage reference returned by the
appender.

Since we used to return 0 in all cases, the staleness tracking is now
broken.

Solution is to return a fake reference of 1, just to indicate success.

Alternative solution would be to make a unique reference for each series
label set, but that incurs an overhead which we can avoid.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
songy23 pushed a commit that referenced this pull request Oct 31, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

In the dependency upgrade #43890 there was the PR
prometheus/prometheus#16429 which changed the
provisions for staleness tracking. Now the code only does the tracking
if the series was successfully appended in storage. This is indicated by
a non zero storage reference returned by the appender.

Since we used to return 0 in all cases, the staleness tracking is now
broken.

Solution is to return a fake reference of 1, just to indicate success.

Alternative solution would be to make a unique reference for each series
label set, but that incurs an overhead which we can avoid.

Performance impact: probably small as the cache should be stable over
time - unless targets churn a lot between receiver instances.

Resource utilization: +1 hashmap with series identifier (name+labels)
pointing to cache entries. Size related to number of series. `addRef`
here:
https://github.com/prometheus/prometheus/blob/c8f1de18a7870e5dc99ed50119c194691c41e41c/scrape/scrape.go#L1089

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes #43893

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Un-skip related tests.

---------

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
jelly-afk pushed a commit to jelly-afk/opentelemetry-collector-contrib that referenced this pull request Nov 6, 2025
Both k8s and prometheus libraries have to be updated because they depend
on each other and both have breaking changes.

The following files changed to adopt to the API breaking changes:
- processor/k8sattributesprocessor/internal/kube/fake_informer.go:
  - kubernetes/kubernetes#126387
- receiver/prometheusreceiver/metrics_receiver.go:
  - prometheus/prometheus#16257
- receiver/prometheusremotewritereceiver/receiver.go:
  - prometheus/prometheus#17160

I haven't touched any usages of deprecated k8s API to keep the changeset
small. Created a separate issue for that instead
open-telemetry#43891

Some prometheus tests are failing due to behavioral change in prometheus
library. I skipped them for now and reported
open-telemetry#43893
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants