Skip to content

feat: Upgrade prometheus to version 0.309.1#5479

Merged
jharvey10 merged 9 commits into
mainfrom
jdh/prometheus-upgrade
Feb 18, 2026
Merged

feat: Upgrade prometheus to version 0.309.1#5479
jharvey10 merged 9 commits into
mainfrom
jdh/prometheus-upgrade

Conversation

@jharvey10
Copy link
Copy Markdown
Contributor

@jharvey10 jharvey10 commented Feb 9, 2026

Prometheus Dependency Update — 2026-02-09

Upgraded github.com/prometheus/prometheus from v0.308.0 (v3.8.0) to v0.309.1 (v3.9.1) across all modules. The other Prometheus client libraries were already at their latest compatible versions.

API changes in Prometheus v0.309.1

Prometheus renamed "Created Timestamp" to "Start Timestamp" throughout the storage.Appender interface:

  • AppendCTZeroSampleAppendSTZeroSample
  • AppendHistogramCTZeroSampleAppendHistogramSTZeroSample
  • CreatedTimestampAppenderStartTimestampAppender
  • Commit()/Rollback() moved into a new embedded AppenderTransaction interface (no code changes needed for this)

All Alloy implementations of storage.Appender were updated to match.

Fork of otel-contrib prometheusreceiver

The upstream receiver/prometheusreceiver at v0.142.0 implements storage.Appender with the old method names. The fix landed upstream in otel-contrib v0.144.0, but that requires OTel Collector v1.50.0 which we aren't on yet.

To bridge the gap, I created the release/142-prometheus-0.309 branch on grafana/opentelemetry-collector-contrib with the minimal rename applied on top of v0.142.0. A replace directive points to that branch. This replace should be removed during the next OTel Collector upgrade (v0.144.0+).

walqueue update

github.com/grafana/walqueue was updated to a newer commit (92af63e, merged upstream 2026-01-22) that implements the renamed storage.Appender methods.

featuregate replace removed

The go.opentelemetry.io/collector/featuregate replace directive (and the otelfeaturegatefix blank imports) were removed. The upstream issue (prometheus/prometheus#13842) was resolved in 2024 and the fork was no longer needed.

Along with this, there were a couple additional duplicate featuregate registrations that were either removed entirely or replaced with lazy evaluation.

Test fix

One converter test expectation was updated — hash-based endpoint names in prom_remote_write.alloy changed due to the Prometheus config struct changes. This is cosmetic and not user-facing.

@jharvey10 jharvey10 requested a review from a team as a code owner February 9, 2026 16:04
@jharvey10 jharvey10 force-pushed the jdh/prometheus-upgrade branch from 268513a to ba80e07 Compare February 9, 2026 20:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 9, 2026

🔍 Dependency Review

Below is a dependency-change review scoped to the Go module changes in this PR. For each changed dependency, I’ve checked its changelog and relevant upstream PRs where possible and assessed required code changes between the “as-is” and “to-be” versions. I’ve included compact, actionable diffs where code updates are needed and evidence links or reasoning in the details.

Highlights

  • Prometheus v0.309.1 introduces a breaking change to the storage.Appender API: CT (Creation Timestamp) methods are renamed to ST (Start Time). Code updates are required where you implement or call these APIs.
  • The custom featuregate duplicate-registration workaround is removed; upstream featuregate is now used. Code should avoid re-registering feature gates and instead look up the existing one.
  • A targeted fork is pinned for the OTel Contrib prometheusreceiver so the repo can consume Prometheus v0.309.1 without yet bumping the OTel Collector. No direct code changes required for this fork, but keep the note to remove once the collector is upgraded.

github.com/prometheus/prometheus v0.308.1 -> v0.309.1 — ❌ Changes Needed

Breaking API change in storage.Appender:

  • AppendCTZeroSample renamed to AppendSTZeroSample.
  • AppendHistogramCTZeroSample renamed to AppendHistogramSTZeroSample.
  • Parameter name reflects CT (creation time) -> ST (start time). Semantics unchanged, but method names differ.

Evidence

  • This API rename is reflected in the Prometheus storage appender interface evolution. The PR already updates your code to match by renaming all CT* methods to ST* variants across your appender implementations, fanouts, interceptors, tests, and mocks.

What to change (patterns applied in this PR)

  1. Update all storage.Appender implementers:
- func (a *appender) AppendCTZeroSample(ref storage.SeriesRef, l labels.Labels, t, ct int64) (storage.SeriesRef, error) {
+ func (a *appender) AppendSTZeroSample(ref storage.SeriesRef, l labels.Labels, t, st int64) (storage.SeriesRef, error) {
     ...
 }

- func (a *appender) AppendHistogramCTZeroSample(ref storage.SeriesRef, l labels.Labels, t, ct int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
+ func (a *appender) AppendHistogramSTZeroSample(ref storage.SeriesRef, l labels.Labels, t, st int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
     ...
 }
  1. Update wrappers/fanouts that delegate to child appenders:
- _, err := x.AppendCTZeroSample(ref, l, t, ct)
+ _, err := x.AppendSTZeroSample(ref, l, t, st)

- _, err := x.AppendHistogramCTZeroSample(ref, l, t, ct, h, fh)
+ _, err := x.AppendHistogramSTZeroSample(ref, l, t, st, h, fh)
  1. Update interceptors/middleware layers:
- onAppendCTZeroSample func(ref storage.SeriesRef, l labels.Labels, t, ct int64, next storage.Appender) (storage.SeriesRef, error)
+ onAppendSTZeroSample func(ref storage.SeriesRef, l labels.Labels, t, st int64, next storage.Appender) (storage.SeriesRef, error)

- func WithCTZeroSampleHook(f func(ref storage.SeriesRef, l labels.Labels, t, ct int64, next storage.Appender) (storage.SeriesRef, error)) InterceptorOption
+ func WithSTZeroSampleHook(f func(ref storage.SeriesRef, l labels.Labels, t, st int64, next storage.Appender) (storage.SeriesRef, error)) InterceptorOption

- return a.child.AppendCTZeroSample(ref, l, t, ct)
+ return a.child.AppendSTZeroSample(ref, l, t, st)

- return a.child.AppendHistogramCTZeroSample(ref, l, t, ct, h, fh)
+ return a.child.AppendHistogramSTZeroSample(ref, l, t, st, h, fh)
  1. Update tests/mocks/stubs:
- func (a *strictMetadataAppender) AppendCTZeroSample(...)
+ func (a *strictMetadataAppender) AppendSTZeroSample(...)

- func (a *strictMetadataAppender) AppendHistogramCTZeroSample(...)
+ func (a *strictMetadataAppender) AppendHistogramSTZeroSample(...)

- _, err := tr.AppendCTZeroSample(...)
+ _, err := tr.AppendSTZeroSample(...)

- _, err := tr.AppendHistogramCTZeroSample(...)
+ _, err := tr.AppendHistogramSTZeroSample(...)
  1. Update any variable names that were “ct” to “st” where it clarifies intent:
- func (..., t, ct int64) { ... }
+ func (..., t, st int64) { ... }

These changes maintain the previous behavior; only symbol names have changed to align with the upstream API.

go.opentelemetry.io/collector/featuregate (remove custom replace) -> upstream v1.51.0 (indirect) — ⚠️ Needs Review

Context

  • Previously, a replace pointed to a Grafana fork that tolerated duplicate feature gate registrations. That workaround is removed. The build now pulls the upstream featuregate.

Impact

  • Code must avoid re-registering a gate that is already registered elsewhere (panics in upstream).
  • This PR adjusts code to “lookup” the gate in the global registry before registering:
    • prom_to_otlp.{go,test}.go now uses a helper to find an existing gate by ID and only reads its state, avoiding MustRegister of a duplicate.

Recommended pattern (already applied here)

func lookupFeatureGate(id string) *featuregate.Gate {
    var g *featuregate.Gate
    featuregate.GlobalRegistry().VisitAll(func(gate *featuregate.Gate) {
        if gate.ID() == id {
            g = gate
        }
    })
    return g
}

// Usage
if g := lookupFeatureGate(removeOldSemconvFeatureGateID); g == nil || !g.IsEnabled() {
    // do legacy behavior
}

Additionally, tests now “ensure” a gate exists for isolated runs without double-registering:

func ensureFeatureGate(t *testing.T, id string) *featuregate.Gate {
    if g := lookupFeatureGate(id); g != nil {
        return g
    }
    g, err := featuregate.GlobalRegistry().Register(id, featuregate.StageAlpha)
    require.NoError(t, err)
    return g
}

Action

  • Review any other code paths that might still call MustRegister on a gate ID that the upstream already registers; convert them to lookup-and-use to prevent panics.
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver (new replace to Grafana fork) — ⚠️ Needs Review

Context

  • A replace is added to pin a Grafana forked prometheusreceiver so the repo can upgrade to Prometheus v0.309.1 while staying on OTel Collector v0.142.0. A TODO notes to remove the fork when upgrading the collector to >= v0.144.0.

Impact

  • No direct code changes are needed in your repo; this is a compatibility pin so the receiver compiles against the new Prometheus API.

Action

  • Keep the TODO: once the collector is upgraded to v0.144.0+, remove this replace to return to upstream.
github.com/prometheus/alertmanager v0.28.1 -> v0.30.0 — ✅ Safe

Review

  • Minor/feature releases primarily internal to the Alertmanager binary and client. No direct usage in this repository is evident that would require API changes.

Action

  • None.

References

  • Alertmanager changelogs note feature work and bugfixes; the public Go surface used as an indirect dep remains compatible.
github.com/envoyproxy/go-control-plane/envoy v1.35.0 -> v1.36.0 — ✅ Safe

Review

  • Proto definitions bump. Used indirectly via generated code. No breaking API surfaced in your codebase.

Action

  • None.
github.com/envoyproxy/protoc-gen-validate v1.2.1 -> v1.3.0 — ✅ Safe

Review

  • Codegen helper for validation. Indirect usage in generated protos; no code changes needed in this repo.

Action

  • None.
github.com/go-openapi/* (analysis, errors, jsonreference, loads, runtime, spec, strfmt, swag*, validate) — patch/minor bumps — ✅ Safe

Review

  • All bumps are minor/patch within v0.x lines. These are used mostly for client/server OpenAPI helpers.
  • No removals/renames detected that would break typical usage in this repository, and the PR has no code changes touching these packages.

Action

  • None.
github.com/go-resty/resty/v2 v2.16.5 -> v2.17.1 — ✅ Safe

Review

  • Patch/minor bump. No breaking API changes noted in changelog; typical code remains valid.

Action

  • None.
github.com/miekg/dns v1.1.68 -> v1.1.69 — ✅ Safe

Review

  • Patch bump with fixes. API stable. No code changes required.

Action

  • None.
Cloud SDK bumps (indirect)
  • github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1 -> v1.20.0 — ✅ Safe
  • github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.12.0 -> v1.13.1 — ✅ Safe
  • github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0 -> v1.6.0 — ✅ Safe
  • github.com/aws/aws-sdk-go-v2/service/ec2 v1.274.0 -> v1.277.0 — ✅ Safe
  • github.com/aws/aws-sdk-go-v2/service/ecs v1.67.2 -> v1.69.5 — ✅ Safe
  • github.com/aws/aws-sdk-go-v2/service/lightsail v1.50.4 -> v1.50.10 — ✅ Safe
  • github.com/digitalocean/godo v1.168.0 -> v1.171.0 — ✅ Safe
  • github.com/gophercloud/gophercloud/v2 v2.8.0 -> v2.9.0 — ✅ Safe
  • github.com/ionos-cloud/sdk-go/v6 v6.3.4 -> v6.3.5 — ✅ Safe
  • github.com/linode/linodego v1.60.0 -> v1.63.0 — ✅ Safe
  • github.com/stackitcloud/stackit-sdk-go/core v0.17.3 -> v0.20.1 — ✅ Safe

Review

  • All are minor/patch bumps. No breaking API changes observed. These are mostly indirect and not used directly in your codebase.

Action

  • None.
Kubernetes clients (indirect): k8s.io/api and k8s.io/client-go v0.34.2 -> v0.34.3 — ✅ Safe

Review

  • Patch releases. No API removals; consumers on the same minor generally remain binary and source compatible.

Action

  • None.
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 -> v0.64.0 — ✅ Safe

Review

  • Minor bump; no breaking API reported. Indirect use only.

Action

  • None.
github.com/KimMachineGun/automemlimit v0.7.4 -> v0.7.5 — ✅ Safe

Review

  • Patch release; no breaking API changes noted.

Action

  • None.
github.com/google/pprof (pseudo) — bump — ✅ Safe

Review

  • Periodic upstream update. Not used in a way that imposes breaking changes in this repo.

Action

  • None.
github.com/grafana/walqueue (pseudo) — bump — ✅ Safe

Review

  • Internal fork bump. No code changes in this repo required by the update.

Action

  • None.
Removed: github.com/asaskevich/govalidator (indirect) — ✅ Safe

Review

  • This dependency is no longer required by your dependency graph. No code in this repo imports it; removal is safe.

Action

  • None.

Notes

  • The PR already contains all necessary code changes for the Prometheus v0.309.1 API rename (CT -> ST) and for safe feature gate handling with the upstream OTel featuregate. The diffs above reflect those changes and can be used as a checklist if additional implementers exist in other packages.
  • A scoped replace is added for the OTel Contrib prometheusreceiver to bridge Prometheus v0.309.1 with OTel Collector v0.142.0. Keep the TODO to remove this once the OTel Collector is updated to v0.144.0+.
  • No additional action is needed for the numerous minor/patch indirect bumps listed above; they are assessed as safe.

@github-actions
Copy link
Copy Markdown
Contributor

TruffleHog Scan Results

Summary: Found 11 potential secrets (0 verified, 11 unverified)

  • Possible secret (DatadogToken) at collector/go.sum:78gnoy***ANOi
  • Possible secret (DatadogToken) at collector/go.sum:39apjx***uJsA
  • Possible secret (DatadogToken) at collector/go.sum:99vYIv***Th0O
  • Possible secret (DatadogToken) at extension/alloyengine/go.sum:107gnoy***ANOi
  • Possible secret (DatadogToken) at extension/alloyengine/go.sum:99vYIv***Th0O
  • Possible secret (DatadogToken) at extension/alloyengine/go.sum:3gnoy***ANOi
  • Possible secret (DatadogToken) at extension/alloyengine/go.sum:39apjx***uJsA
  • Possible secret (DatadogToken) at go.sum:12gnoy***ANOi
  • Possible secret (DatadogToken) at go.sum:101vYIv***Th0O
  • Possible secret (DatadogToken) at go.sum:41apjx***uJsA
  • Possible secret (DatadogToken) at go.sum:118gnoy***ANOi

Review: Check if unverified secrets are false positives.

@jharvey10 jharvey10 merged commit e412321 into main Feb 18, 2026
47 checks passed
@jharvey10 jharvey10 deleted the jdh/prometheus-upgrade branch February 18, 2026 18:56
jharvey10 added a commit that referenced this pull request Feb 26, 2026
# Prometheus Dependency Update — 2026-02-09

Upgraded `github.com/prometheus/prometheus` from v0.308.0 (v3.8.0) to
v0.309.1 (v3.9.1) across all modules. The other Prometheus client
libraries were already at their latest compatible versions.

## API changes in Prometheus v0.309.1

Prometheus renamed "Created Timestamp" to "Start Timestamp" throughout
the `storage.Appender` interface:

- `AppendCTZeroSample` → `AppendSTZeroSample`
- `AppendHistogramCTZeroSample` → `AppendHistogramSTZeroSample`
- `CreatedTimestampAppender` → `StartTimestampAppender`
- `Commit()`/`Rollback()` moved into a new embedded
`AppenderTransaction` interface (no code changes needed for this)

All Alloy implementations of `storage.Appender` were updated to match.

## Fork of otel-contrib prometheusreceiver

The upstream `receiver/prometheusreceiver` at v0.142.0 implements
`storage.Appender` with the old method names. The fix landed upstream in
otel-contrib v0.144.0, but that requires OTel Collector v1.50.0 which we
aren't on yet.

To bridge the gap, I created the `release/142-prometheus-0.309` branch
on `grafana/opentelemetry-collector-contrib` with the minimal rename
applied on top of v0.142.0. A replace directive points to that branch.
This replace should be removed during the next OTel Collector upgrade
(v0.144.0+).

## walqueue update

`github.com/grafana/walqueue` was updated to a newer commit (92af63e,
merged upstream 2026-01-22) that implements the renamed
`storage.Appender` methods.

## featuregate replace removed

The `go.opentelemetry.io/collector/featuregate` replace directive (and
the `otelfeaturegatefix` blank imports) were removed. The upstream issue
(prometheus/prometheus#13842) was resolved in 2024 and the fork was no
longer needed.

Along with this, there were a couple additional duplicate featuregate
registrations that were either removed entirely or replaced with lazy
evaluation.

## Test fix

One converter test expectation was updated — hash-based endpoint names
in `prom_remote_write.alloy` changed due to the Prometheus config struct
changes. This is cosmetic and not user-facing.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 5, 2026
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.

2 participants