Skip to content

feat: support metric relabelings for dcgm exporter - #2939

Closed
efegokdemir wants to merge 1 commit into
NVIDIA:mainfrom
efegokdemir:codex/issue-2938-metric-relabelings
Closed

efegokdemir wants to merge 1 commit into
NVIDIA:mainfrom
efegokdemir:codex/issue-2938-metric-relabelings

Conversation

@efegokdemir

Copy link
Copy Markdown

Description

Adds Helm and ClusterPolicy support for configuring Prometheus metricRelabelings on the DCGM Exporter ServiceMonitor, addressing #2938.

Changes

  • Added metricRelabelings to the shared ServiceMonitor API configuration and generated CRDs/deepcopy assets.
  • Applied configured metric relabeling rules to the generated ServiceMonitor endpoint.
  • Added the Helm value and template path for DCGM Exporter.
  • Extended the ServiceMonitor controller test to verify the rendered metric relabeling configuration.

Testing

  • go test ./controllers -run '^TestServiceMonitor$' -count=1
  • make unit-test
  • make generate manifests
  • make validate-generated-assets
  • make validate-modules
  • make fmt
  • make validate-helm-values
  • git diff --check
  • Helm rendering verified that metricRelabelings reaches the rendered ClusterPolicy.
  • make lint ⚠️ reports three pre-existing SA4023 findings in cmd/nvidia-validator/main.go; no findings are in the changed files.

Notes

The generated CRD and bundle changes are included as required by the repository instructions. This contribution was prepared with AI assistance and reviewed against the repository's existing ServiceMonitor implementation and tests.

Fixes #2938

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
@copy-pr-bot

copy-pr-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

📝 Walkthrough

Walkthrough

ServiceMonitorConfig now exposes optional MetricRelabelings. The controller copies non-nil entries to the first ServiceMonitor endpoint. The DCGM exporter manifest conditionally renders the entries. Helm values define an empty default list. Tests verify replacement of exported_namespace with namespace.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to bbe4b

Add rendered-manifest coverage for configured metric relabelings before merging so Helm users are protected from regressions in the new configuration path.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
controllers/object_controls_test.go-2011-2015 (1)

2011-2015: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Add render coverage for metricRelabelings.

TestDCGMExporterServiceMonitorRendered enables a ServiceMonitor but sets only Interval and checks only its name. Set a non-empty MetricRelabelings value and assert the rendered spec.endpoints[0].metricRelabelings field.

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/gpu-operator/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 66496226-62be-4384-856f-d12a2dcacf64

📥 Commits

Reviewing files that changed from the base of the PR and between bf73d07 and bbe4b50.

⛔ Files ignored due to path filters (7)
  • api/nvidia/v1/zz_generated.deepcopy.go is excluded by !**/zz_generated.*.go
  • bundle/manifests/nvidia.com_clusterpolicies.yaml is excluded by !bundle/manifests/nvidia.com_*.yaml
  • bundle/manifests/nvidia.com_gpuclusters.yaml is excluded by !bundle/manifests/nvidia.com_*.yaml
  • config/crd/bases/nvidia.com_clusterpolicies.yaml is excluded by !config/crd/bases/**
  • config/crd/bases/nvidia.com_gpuclusters.yaml is excluded by !config/crd/bases/**
  • deployments/gpu-operator/crds/nvidia.com_clusterpolicies.yaml is excluded by !deployments/gpu-operator/crds/**
  • deployments/gpu-operator/crds/nvidia.com_gpuclusters.yaml is excluded by !deployments/gpu-operator/crds/**
📒 Files selected for processing (5)
  • api/nvidia/v1/clusterpolicy_types.go
  • controllers/object_controls.go
  • controllers/object_controls_test.go
  • deployments/gpu-operator/values.yaml
  • manifests/state-dcgm-exporter/0600_service_monitor.yaml

Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review.

@dims dims closed this Sep 22, 2026
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.

[Feature]: add metricRelabelings field to the dcgm exporter service monitor.

2 participants