Skip to content

Integrate GMP fork packages and logic (3.13) - #329

Merged
bernot-dev merged 3 commits into
release-3.13.0-gmpfrom
bernot-dev/release-3.13.0-gmp
Jul 21, 2026
Merged

Integrate GMP fork packages and logic (3.13)#329
bernot-dev merged 3 commits into
release-3.13.0-gmpfrom
bernot-dev/release-3.13.0-gmp

Conversation

@bernot-dev

Copy link
Copy Markdown
Collaborator

Commit Breakdown:

  • google-patch[libs] : Adds custom packages for export (GCM export pipeline), secrets (Kubernetes secret provider), lease (master-election lease), and prw2gcm (Remote Write v2 converter proxy).
  • google-patch[logic] : Modifies the Prometheus runtime, configuration, scrape loop, and storage appenders (TSDB/Agent) to plug in GCM exporting, target metadata retrieval, and secret configuration. Includes the --gmp.storage.delete-data-on-start flag.
  • google-patch[setup] : Adds build scripts ( google_vendor.sh ), a custom dockerfile ( Dockerfile.google with BoringCrypto enabled), and presubmit workflow pipelines ( .github/workflows/presubmit.yml ).

@bernot-dev bernot-dev self-assigned this Jul 13, 2026
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread .github/workflows/presubmit.yml Dismissed
Comment thread Dockerfile.google Dismissed
Comment thread Dockerfile.google Dismissed

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request integrates Google Cloud Managed Service for Prometheus (GMP) support into the Prometheus fork. Key additions include a GCM exporter, a Kubernetes-based leader election lease, a Kubernetes secret provider, and a proxy (prw2gcm) to convert Remote Write 2.x to GCM v3 TimeSeries. It also introduces GMP-specific configuration options and CLI flags. The review feedback is highly constructive and should be addressed: it highlights a security risk regarding missing TLS options when forwarding bearer tokens, suggests tightening the Authorization header validation to strictly check for the 'Bearer' prefix, recommends removing a fragile sed command in the Makefile, and points out minor code cleanups like removing an obsolete TODO and an uncertain import comment.

Comment thread google/cmd/prw2gcm/main.go Outdated
Comment thread cmd/prometheus/main.go Outdated
Comment thread google/cmd/prw2gcm/Makefile Outdated
Comment thread google/cmd/prw2gcm/io/prometheus/write/v2/codec.go Outdated
Comment thread google/cmd/prw2gcm/proxy.go Outdated
@bwplotka

Copy link
Copy Markdown
Collaborator

Thanks!

Do you mind removing unnecessary checks and docs as we did in the past (clarity, clean CI): https://github.com/GoogleCloudPlatform/prometheus-engine/pull/1712/changes#r3571934103

@bernot-dev
bernot-dev force-pushed the bernot-dev/release-3.13.0-gmp branch from 7d4a7b9 to 4ac9c11 Compare July 13, 2026 16:49

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! It looks mostly ok. Biggest comments are on google/ dir, UTF-8 feature , agent mode and Dockerfile

Re export: Let's make sure we are very strict on google/ dir changes to avoid surprises. Those should be 1:1 copied from the old version and only changed to make it build, without unrelated changes. Here is the preview of what changed: #330

Let's also manually check UI if it works with basic ops on a local container.

Thanks!

Comment thread cmd/prometheus/main.go Outdated
Comment thread google/cmd/prw2gcm/io/prometheus/write/v2/codec.go Outdated
Comment thread scrape/scrape.go
Comment thread scrape/scrape.go Outdated
Comment thread google/config/config.go
Comment thread tsdb/agent/db.go
Comment thread tsdb/head.go Outdated
Comment thread tsdb/head_append_v2.go Outdated
Comment thread Dockerfile.google Outdated
Comment thread Dockerfile.google
@bernot-dev
bernot-dev force-pushed the bernot-dev/release-3.13.0-gmp branch 5 times, most recently from c65f735 to f1e1914 Compare July 14, 2026 06:17
@bernot-dev
bernot-dev marked this pull request as ready for review July 14, 2026 06:22
@bernot-dev
bernot-dev requested a review from bwplotka July 14, 2026 13:54
@bernot-dev
bernot-dev force-pushed the bernot-dev/release-3.13.0-gmp branch from f1e1914 to 22269e0 Compare July 14, 2026 17:58

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Mostly nits (consistency) modulo UI check, and watcher secret tests.

Comment thread google/export/export.go
// changed and applied to the exporter, potentially recreating the metric client.
// NOTE: Runtime configuration will not override disable/disableAuth options from flags.
func (e *Exporter) ApplyConfig(cfg *config.Config) (err error) {
if e.opts.Disable {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why fixing now though in this big PR?

There were some semantics for credentials that we need to be mindful that's why I was curious if you are sure it this does not have side effects, sounds like you are

Comment thread google/export/transform.go Outdated
// It returns when a series is consumed which completes a full distribution.
// Once all series for a single distribution have been observed, it returns it.
// It returns the reset timestamp along with the distribution and the remaining samples.
func (b *sampleBuilder) buildDistribution(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ping

Comment thread google/secrets/watch.go
return watcher, nil
}

func (w *secretWatcher) update(logger log.Logger, e watch.Event, config *KubernetesSecretConfig) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As per https://github.com/GoogleCloudPlatform/prometheus/pull/330/changes#r3587278927 let's add test for the new change secret.Name == config.Name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes / no? (:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread tsdb/agent/db.go
Comment thread tsdb/agent/db.go Outdated
Comment thread tsdb/head_append_v2.go Outdated
Comment thread Dockerfile.google
@bwplotka

Copy link
Copy Markdown
Collaborator

Regenerated #330

We are mostly missing interleaving histogram fix and some tests to verify new watcher fix.

@bernot-dev bernot-dev changed the title Integrate Google Managed Prometheus (GMP) fork packages and logic Integrate GMP fork packages and logic (3.13) Jul 16, 2026
… prw2gcm, promtest)

Signed-off-by: Adam Bernot <bernot@google.com>
Signed-off-by: Adam Bernot <bernot@google.com>
@bernot-dev
bernot-dev force-pushed the bernot-dev/release-3.13.0-gmp branch 2 times, most recently from 73c19ac to feb2fb9 Compare July 21, 2026 15:36
@bernot-dev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces several changes to support a Google Cloud Managed Service for Prometheus (GMP) fork, including updates to the Dockerfile, Makefile, documentation, and main entry point. It also adds new Google-specific packages for export, secrets management, and lease handling. I have identified critical issues in the pool.go implementation regarding map modification during iteration and several best-practice improvements for the Dockerfile, such as combining apt-get commands and fixing syntax errors.

Comment thread google/export/pool.go
Comment thread Dockerfile.google
Comment thread Dockerfile.google Outdated

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks solid, thanks! One nit, but otherwise good to go

Signed-off-by: Adam Bernot <bernot@google.com>
@bernot-dev
bernot-dev force-pushed the bernot-dev/release-3.13.0-gmp branch from feb2fb9 to 3685c7a Compare July 21, 2026 17:26
@bernot-dev
bernot-dev merged commit 93be068 into release-3.13.0-gmp Jul 21, 2026
4 checks passed
Comment thread google/export/export.go
}

// Metrics Prometheus writes at scrape time for which no metadata is exposed.
var internalMetricMetadata = map[string]MetricMetadata{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Noticed one more thing. We have to likely expand this list with new metrics https://github.com/prometheus/prometheus/blob/47ce985126421014585c0eea59febe124eb02b81/scrape/scrape.go#L2061-L2100

While they have metadata upstream, it escapes scrapeloop cache export rely on.

Essentially reportExtraMetrics will produce unknown and unknown:gauge. This is not a default behavior, so should be ok.

Comment thread scrape/scrape.go
// service requires metric names to adhere to stricter naming conventions.
// Enabling UTF-8 validation could cause scrapes to accept metric names that will
// fail ingestion in GCM. For more details, see the design doc at go/gmp:prom-3.13.
validationScheme: model.LegacyValidation,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This disables UTF-8 scraping - instead we should allow it, but ensure global UTF-8 default is set to legacy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants