Cherry-pick: Add OpenTelemetry metrics for package resources size (#1018)#1052
Merged
efiacor merged 2 commits intoJun 17, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds OpenTelemetry-based telemetry and a Prometheus/Grafana monitoring stack, including new package-size metrics and E2E validations.
Changes:
- Introduces
internal/telemetryfor OTel setup, Prometheus scraping endpoint, and package-size metric instruments. - Records package revision resource-size metrics from DB cache flows and updates E2E tests to assert presence/values.
- Adds monitoring deployment assets (Prometheus, Grafana, dashboards) plus a helper script to deploy them.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/suiteutils/suite_utils.go | Adds Prometheus text parsing utilities for collected metrics so tests can assert specific label/value pairs. |
| test/e2e/suiteutils/suite.go | Simplifies DB cache env detection and makes delete ignore NotFound. |
| test/e2e/api/metrics_test.go | Updates metrics endpoint assertions and adds new tests for package-size metrics and values. |
| scripts/deploy-monitoring.sh | New helper to render/apply monitoring manifests and port-forward Prometheus/Grafana. |
| pkg/cli/commands/rpkg/docs/docs.go | Fixes grammar in CLI docs strings. |
| pkg/cli/commands/rpkg/approve/command_test.go | Clarifies test comment casing. |
| pkg/cache/dbcache/dbreposync.go | Records package resource-size metrics during external PR caching. |
| pkg/cache/dbcache/dbrepository.go | Records package resource-size metrics after closing a draft. |
| pkg/cache/dbcache/dbpackagerevisionresourcessql.go | Records resource-size=0 metric on successful resource deletion. |
| internal/telemetry/otel.go | New unified OTel setup with optional Prometheus HTTP server and lifecycle management. |
| internal/telemetry/metrics.go | New OTel instruments + recording helper for package revision resource size. |
| internal/telemetry/metrics_test.go | Unit tests for metric recording behavior and nil-instrument safety. |
| internal/otel/otel_test.go | Updates tests for new OTel behavior, but file location/package appear inconsistent with new code location. |
| internal/otel/otel.go | Removes old OTel setup implementation. |
| go.mod | Promotes OTel prometheus exporter + metric module to direct deps. |
| func/wrapper-server/main.go | Switches to new telemetry setup and ensures graceful shutdown. |
| func/server/server.go | Switches to new telemetry setup and ensures graceful shutdown. |
| controllers/main.go | Switches to new telemetry setup and ensures graceful shutdown. |
| cmd/porch/main.go | Switches to new telemetry setup and ensures graceful shutdown. |
| docs/content/en/docs/6_configuration_and_deployments/configurations/opentelemetry.md | Documents new metrics and their Prometheus names/labels. |
| deployments/porch/9-controllers.yaml | Adds a Service to expose controller metrics on 9464; trims trailing whitespace. |
| deployments/porch/3-porch-server.yaml | Exposes metrics port and adds a startup probe; adds service port for metrics. |
| deployments/porch/2-function-runner.yaml | Exposes metrics port via Service. |
| deployments/metrics/prometheus-deployment.yaml | Adds prometheus deployment + RBAC + service for monitoring stack. |
| deployments/metrics/grafana-deployment.yaml | Adds grafana deployment + provisioning config + admin secret for monitoring stack. |
| deployments/metrics-resources/prometheus-config.yaml | Prometheus scrape config for Porch components. |
| deployments/metrics-resources/grafana-package-sizes-dashboard.json | Grafana dashboard for package resource size gauge. |
| deployments/function-pods/deployment.yaml | Enables Prometheus exporter env + exposes metrics port for wrapper-server function pods. |
* Feat: Add OpenTelemetry metrics for package resources size - plus enough Prometheus monitoring stack to make it manually testable - picked from changes in WIP kptdev#561 - new histogram- and gauge-type metrics - available in e.g. Prometheus as: - porch_package_size_bytes_bucket - porch_package_size_bytes_count - porch_package_size_bytes_sum - porch_package_size_bytes_total - recorded in Porch flows that update package revision resources: - create package revision - delete package revision - discover/sync package revisions from a registered repository - delete package revisions on unregistering a repository - direct update of PackageRevisionResources in rpkg push Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Update docs to mention new package resources size metrics Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 2 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 3 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 4 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Fix failing unit test Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 5 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 6 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Introduce retrigger.txt for easier CI retriggering Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address copilot review comments part 7 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 8 Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 9 Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * retrigger Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 10 Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * retrigger Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 11 Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * Address review comment Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 12 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> --------- Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>
5ec6aa9 to
88af3f0
Compare
Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>
542d4b8 to
77004bc
Compare
|
liamfallon
approved these changes
Jun 17, 2026
efiacor
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Title
Cherry-pick to 1.5:
Description
Related Issue(s)
Type of Change
Checklist
Testing Instructions (Optional)
Additional Notes (Optional)
AI Disclosure