Skip to content

feat(byoo-otel-collector): add SRE metrics pipeline#266

Merged
kristinapathak merged 1 commit into
mainfrom
feat/byoo-sre-metrics-pipeline
Jul 21, 2026
Merged

feat(byoo-otel-collector): add SRE metrics pipeline#266
kristinapathak merged 1 commit into
mainfrom
feat/byoo-sre-metrics-pipeline

Conversation

@kristinapathak

@kristinapathak kristinapathak commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Add an opt-in BYOO SRE metrics pipeline that fans out OTLP metrics from the customer metrics receiver to a filtered Prometheus scrape endpoint on port 19091.

Additional Details (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

  • Adds BYOO_SRE_METRICS_ENABLED, disabled by default.
  • Adds BYOO_SRE_METRICS_FILTER_CONFIG, a runtime YAML filter processor config for the SRE metrics pipeline. The default keeps only BpsInstrument, FpsInstrument, RtdInstrument, and StageOpenDuration, unless telemetry is explicitly labeled with an SRE metrics opt-out value.
  • Adds BYOO_CUSTOMER_METRICS_DROP_LABELS, a comma-separated resource attribute drop list applied only to the customer metrics pipeline when the SRE pipeline is enabled.
  • Adds the Prometheus exporter component to the generated collector and exposes 19091/tcp from the image.
  • Keeps customer metrics export separate from SRE metrics export by using a separate SRE pipeline and batch processor.
  • Adds a public-safe SRE-enabled rendered config example at examples/otelconfigs/k8s/config_function_container_sre_metrics.yaml.

For the Reviewer

Please look closely at src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render.go, especially the default filter config, pipeline ordering, and customer drop-label processor placement.

For QA (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache go test ./internal/otelconfig
  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache GOMODCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-mod ./scripts/regenerate-otelcol.sh
  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache GOMODCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-mod ./tools/ci/check-otelcol-generated
  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache GOMODCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-mod go test ./...
  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache GOMODCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-mod go test ./otelcol/...
  • GOCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-cache GOMODCACHE=/private/tmp/nvcf-byoo-sre-metrics-go-mod go test ./internal/otelconfig -run TestRenderOtelConfigWithSREMetricsPipelineMatchesExample -count=1
  • Validated examples/otelconfigs/k8s/config_function_container_sre_metrics.yaml with ./_output/bin/otelcol-contrib validate --config=... using local placeholder token/cert/key path substitutions.
  • Generated and parse-validated existing BYOO example configs across testdata/*.json, vm|k8s, container|helm, and task|function using ./_output/bin/otelcol-contrib validate --config=... with local example secret and token path substitutions.

make validate-otelconfig was also attempted. Its config validation phase reached the generated config, but the local macOS runtime startup check fails because the cgroup runtime extension cannot set GOMEMLIMIT on this system.

Issues

Closes #265

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features
    • Added optional SRE metrics support to the OpenTelemetry collector.
    • When enabled, the collector exposes an additional Prometheus /metrics endpoint on port 19091 and adds a dedicated metrics/sre pipeline.
    • Added environment-driven configuration for enabling SRE metrics, filter rules, and dropping selected customer metric labels.
  • Documentation
    • Updated the collector README with the new 19091 endpoint details and environment variables.
  • Tests
    • Extended unit/render tests to validate SRE metrics config parsing, validation, and correct pipeline wiring/exporter behavior.

@kristinapathak
kristinapathak requested a review from a team as a code owner July 20, 2026 16:47
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 84ae2fd7-0355-4b84-9b12-d033c0f89b96

📥 Commits

Reviewing files that changed from the base of the PR and between 4349726 and 14b22f8.

⛔ Files ignored due to path filters (1)
  • src/compute-plane-services/byoo-otel-collector/otelcol/go.sum is excluded by !**/*.sum
📒 Files selected for processing (14)
  • src/compute-plane-services/byoo-otel-collector/Dockerfile
  • src/compute-plane-services/byoo-otel-collector/README.md
  • src/compute-plane-services/byoo-otel-collector/examples/otelconfigs/k8s/config_function_container_sre_metrics.yaml
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/embed_config.go
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig.go
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig_test.go
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render.go
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render_test.go
  • src/compute-plane-services/byoo-otel-collector/otel-collector-build.yaml
  • src/compute-plane-services/byoo-otel-collector/otelcol/components.go
  • src/compute-plane-services/byoo-otel-collector/otelcol/go.mod
  • src/compute-plane-services/byoo-otel-collector/otelcol/main.go
  • src/compute-plane-services/byoo-otel-collector/otelcol/main_others.go
  • src/compute-plane-services/byoo-otel-collector/otelcol/main_windows.go
💤 Files with no reviewable changes (3)
  • src/compute-plane-services/byoo-otel-collector/otelcol/main_others.go
  • src/compute-plane-services/byoo-otel-collector/otelcol/main.go
  • src/compute-plane-services/byoo-otel-collector/otelcol/main_windows.go
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/compute-plane-services/byoo-otel-collector/otelcol/go.mod
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/embed_config.go
  • src/compute-plane-services/byoo-otel-collector/Dockerfile
  • src/compute-plane-services/byoo-otel-collector/otel-collector-build.yaml
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig.go
  • src/compute-plane-services/byoo-otel-collector/examples/otelconfigs/k8s/config_function_container_sre_metrics.yaml
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig_test.go
  • src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render.go
  • src/compute-plane-services/byoo-otel-collector/README.md

📝 Walkthrough

Walkthrough

The collector adds opt-in SRE metrics configuration, registers a Prometheus exporter, exposes port 19091, and renders a separate filtered metrics/sre pipeline when customer metrics telemetry is configured.

Changes

SRE metrics pipeline

Layer / File(s) Summary
SRE metrics configuration contract
src/compute-plane-services/byoo-otel-collector/internal/otelconfig/embed_config.go, src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig.go, src/compute-plane-services/byoo-otel-collector/internal/otelconfig/otelconfig_test.go
Adds SRE metrics fields to template and environment configuration, including filter parsing, label-drop settings, and invalid-configuration tests.
Prometheus exporter packaging
src/compute-plane-services/byoo-otel-collector/otel-collector-build.yaml, src/compute-plane-services/byoo-otel-collector/otelcol/go.mod, src/compute-plane-services/byoo-otel-collector/otelcol/components.go, src/compute-plane-services/byoo-otel-collector/Dockerfile, src/compute-plane-services/byoo-otel-collector/README.md
Registers the Prometheus exporter, adds its module dependency, exposes port 19091, and documents the endpoint and runtime settings.
SRE pipeline rendering and validation
src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render.go, src/compute-plane-services/byoo-otel-collector/internal/otelconfig/render_test.go, src/compute-plane-services/byoo-otel-collector/examples/otelconfigs/k8s/config_function_container_sre_metrics.yaml
Adds configurable filter resolution, customer label removal, Prometheus exporter configuration, dedicated batching, and the optional metrics/sre pipeline with rendering tests and an example configuration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OTLPReceiver
  participant CustomerMetricsPipeline
  participant SREMetricsPipeline
  participant PrometheusExporter
  OTLPReceiver->>CustomerMetricsPipeline: Receive customer OTLP metrics
  OTLPReceiver->>SREMetricsPipeline: Reuse OTLP metrics receiver
  CustomerMetricsPipeline->>CustomerMetricsPipeline: Drop configured SRE control labels
  SREMetricsPipeline->>SREMetricsPipeline: Apply filter and dedicated batch processors
  SREMetricsPipeline->>PrometheusExporter: Export filtered SRE metrics
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also removes SPDX license headers from generated Go files, which is unrelated to the SRE metrics pipeline work. Move the header-only cleanup into a separate PR or revert it from this change so the diff stays focused on the SRE metrics pipeline.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an SRE metrics pipeline.
Linked Issues check ✅ Passed The PR implements the disabled-by-default SRE metrics pipeline, runtime config, dedicated exporter/port, and guarded pipeline behavior described in the issue.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/byoo-sre-metrics-pipeline

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🛡️ CodeQL Analysis

🚨 Found 2 issue(s)

Severity Breakdown:

  • 🔴 Errors: 0
  • 🟡 Warnings: 0
  • 🔵 Notes: 0
📋 Top Issues

🔗 View full details in Security tab

🕐 Last updated: 2026-07-20 16:49:46 UTC | Commit: dd541bf

@kristinapathak
kristinapathak force-pushed the feat/byoo-sre-metrics-pipeline branch from dd541bf to 4349726 Compare July 20, 2026 17:30
Refs #265

Signed-off-by: Kristina Pathak <kristina.m.pathak@gmail.com>
@kristinapathak
kristinapathak force-pushed the feat/byoo-sre-metrics-pipeline branch from 4349726 to 14b22f8 Compare July 21, 2026 06:07
@kristinapathak
kristinapathak added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 5e459d7 Jul 21, 2026
16 checks passed
@kristinapathak
kristinapathak deleted the feat/byoo-sre-metrics-pipeline branch July 21, 2026 20:21
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.

Add optional BYOO SRE metrics scrape pipeline

2 participants