Skip to content

Fixing prom v3 upgrade issues - #4044

Merged
thampiotr merged 24 commits into
mainfrom
thampiotr/fixing-promv3
Aug 5, 2025
Merged

Fixing prom v3 upgrade issues#4044
thampiotr merged 24 commits into
mainfrom
thampiotr/fixing-promv3

Conversation

@thampiotr

@thampiotr thampiotr commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

PR Description

Fixes several issues that the upgrade to prom v3 has introduced:

  • Updated to new Prometheus version with a fix for memory corruption. Fix corruption in parser for alloy fork prometheus#43
  • Updated Prometheus/common version with a fix to delimited proto not escaped correctly: Fix delimited proto not escaped correctly prometheus/common#809
  • Change the default metric validation scheme back to 'legacy' because most of backends that Alloy users depend on do not support yet UTF-8.
  • Change scrape_native_histograms default to false as it was incorrectly set to true in the upgrade.
  • Fixed few documentation issues in prometheus.scrape
  • Update integration test to use the new WAL. More work will be needed to test other configurations.
  • Added missing tests to scrape config defaults
  • Added a timeout when shutting down the worker pool to prevent Alloy from handing when initial config load fails.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@github-actions

github-actions Bot commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

💻 Deploy preview deleted.

Comment thread internal/component/prometheus/scrape/scrape.go
@thampiotr thampiotr changed the title Thampiotr/fixing-promv3 Fixing prom v3 upgrade issues Jul 23, 2025
send_native_histograms = true
metadata_config {
send_interval = "1s"
prometheus.write.queue "scrape_prom_metrics" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As a follow up, I want to expand our integration tests to cover more cases and protocols and use old remote_write component too. But for now we should switch to the one we use most commonly: new WAL with (mostly) default settings. The only settings we're giving here are to make the test go faster.

Comment thread internal/runtime/internal/controller/loader.go Outdated
Comment thread internal/component/prometheus/scrape/scrape.go
Comment thread internal/runtime/internal/worker/worker_pool.go Outdated
Comment thread internal/runtime/internal/controller/loader.go Outdated
@thampiotr
thampiotr force-pushed the thampiotr/fixing-promv3 branch from 1698f0f to 51cd328 Compare July 31, 2025 13:35
Comment thread go.mod Outdated
Comment on lines +1059 to +1062
replace github.com/prometheus/prometheus => github.com/thampiotr/prometheus v0.0.0-20250731131506-a28a7d9c5b3b // staleness_disabling_v3.4.2 branch

// TODO: remove this replace directive once the upstream issue is fixed: https://github.com/prometheus/common/pull/809
replace github.com/prometheus/common => github.com/thampiotr/common v0.0.0-20250801132732-61b386b68d79

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We're almost there! My latest tests have resolved all the issues I know about. The only work remaining is to get the fixes merged upstream:

@ptodev it would be great if we can review the rest and I will just replace these dependencies as soon as upstreams are merged 🤞

Comment thread internal/component/prometheus/scrape/scrape.go
Comment thread go.mod
// * There is a release of Prometheus which addresses https://github.com/prometheus/prometheus/issues/14049,
// for example, via this implementation: https://github.com/grafana/prometheus/pull/34
replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20250709144109-5551df55271b
replace github.com/prometheus/prometheus => github.com/thampiotr/prometheus v0.0.0-20250731131506-a28a7d9c5b3b // staleness_disabling_v3.4.2 branch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can tell we use fix-corrupted-name-label in your fork, that includes the staleness fix. Are we planning to use your fork here or is this only temporary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is temporary while we get this fix prometheus/prometheus#16957 merged upstream. I mentioned on Slack, sorry if you missed this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm happy to merge the PR as long as we don't release the next version with this fork.

Comment thread internal/runtime/internal/worker/worker_pool.go Outdated
@thampiotr
thampiotr marked this pull request as ready for review August 4, 2025 13:04
@thampiotr
thampiotr requested review from a team and clayton-cornell as code owners August 4, 2025 13:04

@kalleep kalleep left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, nice work on this

Comment thread go.mod
// * There is a release of Prometheus which addresses https://github.com/prometheus/prometheus/issues/14049,
// for example, via this implementation: https://github.com/grafana/prometheus/pull/34
replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20250709144109-5551df55271b
replace github.com/prometheus/prometheus => github.com/thampiotr/prometheus v0.0.0-20250731131506-a28a7d9c5b3b // staleness_disabling_v3.4.2 branch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm happy to merge the PR as long as we don't release the next version with this fork.

@thampiotr

Copy link
Copy Markdown
Contributor Author

I'm happy to merge the PR as long as we don't release the next version with this fork.

Thanks! I'll merge now to avoid further toil with merge conflicts and so I can get the dev deployment pipeline working again. I am watching for my upstream merge fixed and will follow-up with fixing the go.mod soon.

@thampiotr
thampiotr merged commit 5bbae9a into main Aug 5, 2025
42 checks passed
@thampiotr
thampiotr deleted the thampiotr/fixing-promv3 branch August 5, 2025 10:50
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants