Skip to content

Upgrade Prometheus to v0.302.1 #40103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 22, 2025

Conversation

npordash
Copy link
Contributor

@npordash npordash commented May 15, 2025

Description

This PR superseeds #38530 (as it went stale), but goes to v0.303.1 instead of v0.302.x.

In order to workaround the behavior change when calling prometheus.config.GetScrapeConfigs() (mentioned here) I've made the following changes in prometheusreceiver:

  1. Added a reloadPromConfig func that will marshal an input as yaml and then load it using prometheus.config.Load to ensure that the un-exported field loaded is set to true
  2. Updated PromConfig.Unmarshal to delegate to reloadPromConfig
  3. Added PromConfig.Reload which delegates to reloadPromConfig to reload itself
  4. Updated newPrometheusReceiver to call PromConfig.Reload to ensure the Prometheus config is loaded
  5. Updated Config.Validate to only check if scrape configs or files have been set instead of calling GetScrapeConfigs since it's not necessary they get built here
  6. Updated PromConfig.Validate to only call GetScrapeConfigs if any where configured

Copy link

linux-foundation-easycla bot commented May 15, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@songy23 songy23 added dependencies Pull requests that update a dependency file Skip Changelog PRs that do not require a CHANGELOG.md entry labels May 22, 2025
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

please rebase

@npordash npordash force-pushed the prometheus_v0.303.1 branch from 595ef6f to 4201547 Compare May 22, 2025 13:42
@npordash
Copy link
Contributor Author

please rebase

@songy23 done

@songy23
Copy link
Member

songy23 commented May 22, 2025

pinging prometheus receiver code owners @Aneurysm9, @dashpole, @ArthurSens, @krajorama for approval

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Thanks a lot for picking up the work I left unfinished ❤️

This problem with the Reload was driving me nuts, I'm super glad you found a solution!
I've tested a few different configurations and the collector seems to start without problems :)

@songy23 songy23 merged commit 38c514b into open-telemetry:main May 22, 2025
175 checks passed
@github-actions github-actions bot added this to the next release milestone May 22, 2025
dragonlord93 pushed a commit to dragonlord93/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
#### Description

This PR superseeds open-telemetry#38530 (as it went stale)~~, but goes to `v0.303.1`
instead of `v0.302.x`~~.

In order to workaround the behavior change when calling
`prometheus.config.GetScrapeConfigs()` (mentioned
[here](open-telemetry#38530 (comment)))
I've made the following changes in `prometheusreceiver`:

1. Added a `reloadPromConfig` func that will marshal an input as yaml
and then load it using `prometheus.config.Load` to ensure that the
un-exported field `loaded` is set to `true`
2. Updated `PromConfig.Unmarshal` to delegate to `reloadPromConfig`
3. Added `PromConfig.Reload` which delegates to `reloadPromConfig` to
reload itself
4. Updated `newPrometheusReceiver` to call `PromConfig.Reload` to ensure
the Prometheus config is `loaded`
5. Updated `Config.Validate` to only check if scrape configs or files
have been set instead of calling `GetScrapeConfigs` since it's not
necessary they get built here
6. Updated `PromConfig.Validate` to only call `GetScrapeConfigs` if any
where configured
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.

6 participants