pkg/beholder: bridge prometheus metrics through otel#2053
Conversation
✅ API Diff Results -
|
b82f4d0 to
33f3121
Compare
e003dc7 to
e4b7a40
Compare
|
Removed comment and fixed condition - please re-ack |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: 66195c6 | Previous: 969150a | Ratio |
|---|---|---|---|
BenchmarkKeystore_Sign/nop/in-process |
792.2 ns/op |
372.6 ns/op |
2.13 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Pull request overview
Adds optional support for bridging existing Prometheus metrics into the Beholder/OpenTelemetry metric pipeline (via the OTel Prometheus bridge), controllable through loop server environment configuration.
Changes:
- Introduces
MetricProducersinbeholder.Configand wires producers into the OTelPeriodicReader. - Adds loop env vars to enable the Prometheus bridge and optionally filter bridged metrics by name prefixes.
- Adds a small Prometheus gatherer wrapper (
PrefixGatherer) and updates Beholder config example to a JSON golden file; updates relevant dependencies.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/sqlutil/promutil/promutil.go | New PrefixGatherer to filter Prometheus metric families by prefix. |
| pkg/loop/server.go | Conditionally attaches OTel Prometheus bridge metric producer to Beholder config. |
| pkg/loop/config.go | Adds env config for enabling the bridge and configuring prefix filters. |
| pkg/loop/config_test.go | Extends env parsing/serialization tests for new bridge env vars. |
| pkg/beholder/config.go | Adds MetricProducers to Beholder config API. |
| pkg/beholder/client.go | Applies MetricProducers to the metrics periodic reader (producer support). |
| pkg/beholder/config_test.go | Replaces prior example output with a JSON golden-file test. |
| pkg/beholder/testdata/config-example.json | New JSON golden file representing example Beholder config. |
| go.mod | Adds OTel Prometheus bridge dependency and updates Prometheus/JWT deps. |
| go.sum | Dependency checksum updates for the above. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func (g *PrefixGatherer) Gather() ([]*dto.MetricFamily, error) { | ||
| var ret []*dto.MetricFamily | ||
| all, err := g.Gatherer.Gather() | ||
| if err != nil { | ||
| return nil, err |
https://smartcontract-it.atlassian.net/browse/CRE-4426
Supports: