Integrate GMP fork packages and logic (3.13) - #329
Conversation
There was a problem hiding this comment.
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.
|
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 |
7d4a7b9 to
4ac9c11
Compare
bwplotka
left a comment
There was a problem hiding this comment.
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!
c65f735 to
f1e1914
Compare
f1e1914 to
22269e0
Compare
| // 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 { |
There was a problem hiding this comment.
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
| // 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( |
| return watcher, nil | ||
| } | ||
|
|
||
| func (w *secretWatcher) update(logger log.Logger, e watch.Event, config *KubernetesSecretConfig) { |
There was a problem hiding this comment.
As per https://github.com/GoogleCloudPlatform/prometheus/pull/330/changes#r3587278927 let's add test for the new change secret.Name == config.Name
There was a problem hiding this comment.
|
Regenerated #330 We are mostly missing interleaving histogram fix and some tests to verify new watcher fix. |
… prw2gcm, promtest) Signed-off-by: Adam Bernot <bernot@google.com>
Signed-off-by: Adam Bernot <bernot@google.com>
73c19ac to
feb2fb9
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
bwplotka
left a comment
There was a problem hiding this comment.
Looks solid, thanks! One nit, but otherwise good to go
Signed-off-by: Adam Bernot <bernot@google.com>
feb2fb9 to
3685c7a
Compare
| } | ||
|
|
||
| // Metrics Prometheus writes at scrape time for which no metadata is exposed. | ||
| var internalMetricMetadata = map[string]MetricMetadata{ |
There was a problem hiding this comment.
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.
| // 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, |
There was a problem hiding this comment.
This disables UTF-8 scraping - instead we should allow it, but ensure global UTF-8 default is set to legacy.
Commit Breakdown: