Skip to content

feat: Add component level metrics configuration for ServiceMonitors - #2189

Merged
jgwest merged 6 commits into
argoproj-labs:masterfrom
jparsai:metrics-config
May 21, 2026
Merged

feat: Add component level metrics configuration for ServiceMonitors#2189
jgwest merged 6 commits into
argoproj-labs:masterfrom
jparsai:metrics-config

Conversation

@jparsai

@jparsai jparsai commented May 7, 2026

Copy link
Copy Markdown
Collaborator

This PR is to add component level Prometheus metrics scraping configurations (interval, scrapeTimeout) to controller, repo, server, and notifications specs

/kind enhancement

Fixes: https://redhat.atlassian.net/browse/GITOPS-9634

Assisted by: Cursor

Summary by CodeRabbit

  • New Features

    • Per-component metrics config (interval, scrapeTimeout) for Controller, Notifications, Repo Server, and Server; CRD/schema and API now expose these fields and conversions preserve them.
  • Bug Fixes

    • Reconcilers now update existing ServiceMonitor endpoints to reflect component metrics changes instead of leaving them unchanged.
  • Documentation

    • Reference docs updated with examples and notes for per-component Prometheus settings and fallback behavior.
  • Tests

    • New unit and E2E tests validating metrics config, conversion, and ServiceMonitor updates.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR extends the Argo CD operator to support per-component Prometheus ServiceMonitor metrics configuration. It introduces a new ArgoCDMetricsSpec type with Interval and ScrapeTimeout fields across both v1alpha1 and v1beta1 API versions, updates conversion logic between versions, modifies ServiceMonitor reconciliation to apply these settings dynamically, and includes unit and E2E tests.

Changes

Per-Component Metrics Scrape Configuration

Layer / File(s) Summary
API Type Definitions
api/v1alpha1/argocd_types.go, api/v1beta1/argocd_types.go
New ArgoCDMetricsSpec struct with Interval and ScrapeTimeout fields; four component specs (ArgoCDApplicationControllerSpec, ArgoCDNotifications, ArgoCDRepoSpec, ArgoCDServerSpec) gain optional Metrics field in both versions.
Deep Copy Support
api/v1alpha1/zz_generated.deepcopy.go, api/v1beta1/zz_generated.deepcopy.go
Autogenerated DeepCopyInto and DeepCopy methods for ArgoCDMetricsSpec; component spec deepcopy methods updated to handle Metrics field.
v1alpha1 ↔ v1beta1 Conversion
api/v1alpha1/argocd_conversion.go
New dedicated functions ConvertAlphaToBetaNotifications and ConvertBetaToAlphaNotifications for bidirectional notifications conversion; controller/repo/server conversion functions updated to explicitly map Metrics fields via new helpers.
Conversion Tests
api/v1alpha1/argocd_conversion_test.go
Added test cases for TestAlphaToBetaConversion and TestBetaToAlphaConversion validating metrics field preservation across component types.
Reconciliation Helpers
controllers/argocd/prometheus.go
getMetricsEndpoint() builds Prometheus Endpoint objects from component metrics specs; updateServiceMonitorEndpointIfNeeded() conditionally updates existing ServiceMonitors when specs change.
ServiceMonitor Reconciliation
controllers/argocd/prometheus.go, controllers/argocd/notifications.go
reconcileMetricsServiceMonitor, reconcileRepoServerServiceMonitor, and reconcileServerMetricsServiceMonitor now apply configurable intervals/timeouts; notifications reconciliation uses metrics helpers to manage endpoint configuration.
Unit Tests
controllers/argocd/prometheus_test.go, controllers/argocd/notifications_test.go
Added TestReconcileMetricsServiceMonitor, TestReconcileRepoServerServiceMonitor, TestReconcileServerMetricsServiceMonitor, TestServiceMonitorEndpointUpdate, and TestReconcileNotifications_ServiceMonitorWithMetrics covering default and custom metrics configuration scenarios.
E2E Integration Tests
tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go
New test suite verifying per-component metrics propagate to ServiceMonitor resources, updates persist through CR changes, and clearing config resets endpoint fields.
CRD Schema
config/crd/bases/argoproj.io_argocds.yaml, bundle/manifests/argoproj.io_argocds.yaml, deploy/olm-catalog/.../argoproj.io_argocds.yaml
OpenAPI schema definitions updated with metrics object containing interval and scrapeTimeout string properties for all four component ServiceMonitor blocks across manifest variants.
Documentation
docs/reference/argocd.md
Reference docs updated with per-component metrics configuration options, example YAML showing controller/repo/server/notifications metrics setup, and clarification on Prometheus default behavior when fields are omitted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • jgwest
  • svghadi
  • akhilnittala

Poem

🐰 I hopped through CRDs, types, and tests tonight,
I nudged ServiceMonitors till their endpoints were right,
Controller, Repo, Server, and Notes in a row,
Interval and timeout now whisper and flow,
A rabbit-approved operator, tidy and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely describes the main change: adding component-level metrics configuration for ServiceMonitors across controller, repo, server, and notifications components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@jparsai
jparsai force-pushed the metrics-config branch 2 times, most recently from 1a581be to f18fb1d Compare May 7, 2026 11:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
bundle/manifests/argoproj.io_argocds.yaml (1)

1249-1258: ⚡ Quick win

Consider adding a duration-format pattern to interval and scrapeTimeout.

Both fields currently accept any string. Prometheus/the monitoring-operator expects valid duration strings (e.g., 30s, 5m, 1h30m). Without schema-level validation, invalid values like "abc" pass CRD admission and silently break the generated ServiceMonitor endpoint—the scrape fails or falls back to defaults with no user-visible error from the ArgoCD operator.

The prometheus-operator CRD validates these same fields using:

               interval:
                 description: |-
                   Interval specifies the Prometheus scrape interval for this component's ServiceMonitor.
                   If empty, Prometheus uses its default scrape interval.
                 type: string
+                pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
               scrapeTimeout:
                 description: |-
                   ScrapeTimeout specifies the Prometheus scrape timeout for this component's ServiceMonitor.
                   If empty, Prometheus uses the global scrape timeout.
                 type: string
+                pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$

This applies identically to all 8 metrics blocks (both API versions, all four components). If you prefer controller-side validation instead, ensure the controller surfaces a clear error status when an invalid duration is provided.

Also applies to: 2171-2180, 4287-4296, 8333-8342, 13798-13807, 18396-18405, 20535-20544, 26357-26366

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bundle/manifests/argoproj.io_argocds.yaml` around lines 1249 - 1258, The CRD
schema currently allows any string for the interval and scrapeTimeout fields, so
add a duration-format regex pattern to their schema entries: for each metrics
block update the properties for "interval" and "scrapeTimeout" (same field names
used in the diff) to include type: string and a pattern that matches Prometheus
duration literals (e.g. use a regex such as
^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ or the equivalent you prefer), and
apply this change to all eight metrics blocks referenced (the other occurrences
listed in the comment) so invalid durations are rejected at CRD validation time.
api/v1beta1/argocd_types.go (1)

449-458: 💤 Low value

Consider adding kubebuilder validation for duration format on Interval and ScrapeTimeout fields.

Interval and ScrapeTimeout are unvalidated strings that flow into monitoringv1.Duration downstream. Adding +kubebuilder:validation:Pattern with the regex ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$ would surface invalid duration values at admission time rather than at scrape time. This pattern matches Prometheus's model.ParseDuration format and is used by prometheus-operator for Duration validation. Optional if you prefer to defer validation to Prometheus.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/v1beta1/argocd_types.go` around lines 449 - 458, The Interval and
ScrapeTimeout fields on ArgoCDMetricsSpec are unvalidated strings; add a
kubebuilder validation pattern to both fields (Interval and ScrapeTimeout on
struct ArgoCDMetricsSpec) to enforce Prometheus/monitoringv1.Duration format by
applying +kubebuilder:validation:Pattern with the regex
^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
so invalid durations are rejected at admission instead of at scrape time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/v1alpha1/argocd_conversion.go`:
- Line 568: The mapping uses the deprecated v1beta1 field Logformat which
triggers SA1019; add the file's standard nolint suppression by appending a
staticcheck nolint to the mapping (e.g., change the mapping line that sets
Logformat: src.Logformat to include a trailing comment // nolint:staticcheck) to
silence the deprecation warning while preserving conversion behavior; optionally
add the same suppression to the symmetric mapping in
ConvertAlphaToBetaNotifications to keep parity if that field becomes deprecated
later.

In `@config/crd/bases/argoproj.io_argocds.yaml`:
- Around line 1238-1247: The CRD currently defines the ServiceMonitor fields
interval and scrapeTimeout as bare strings; add a validation pattern to both to
enforce Prometheus duration format by updating the schema for the fields named
"interval" and "scrapeTimeout" to include a pattern property with the regex
^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
and keep type: string, then regenerate the CRD artifacts so invalid durations
are rejected at admission; apply the same change to all occurrences of these
fields noted in the review (the other repeated blocks).

In `@controllers/argocd/notifications_test.go`:
- Around line 552-554: The test mutates the package-global prometheusAPIFound
before calling r.reconcileNotificationsController(a) which can leak state across
tests; save the original prometheusAPIFound value at the start of the test, set
prometheusAPIFound = true for the assertion, and register a t.Cleanup closure to
restore the saved value after the test finishes so global state is always
reverted; update the test around the call to
r.reconcileNotificationsController(a) accordingly (reference: prometheusAPIFound
and reconcileNotificationsController).

In `@controllers/argocd/prometheus.go`:
- Around line 112-124: The updateServiceMonitorEndpointIfNeeded function
currently replaces the entire endpoint with desired when a few fields differ,
which wipes unmanaged fields; modify it to preserve user-managed fields by
merging the existing endpoint into desired before assigning: locate
updateServiceMonitorEndpointIfNeeded (and the sm.Spec.Endpoints[0] usage) and
for each potentially unmanaged field (e.g., Path, TLSConfig, BearerTokenFile,
BearerToken, MetricRelabelConfigs, RelabelConfigs, HonorLabels, Params,
ProxyURL, FollowRedirects, etc.) copy the value from sm.Spec.Endpoints[0] into
desired when that field is non-empty on the existing endpoint and empty on
desired, then set sm.Spec.Endpoints = []monitoringv1.Endpoint{desired} and call
r.Update(...); alternatively, if full ownership is intended, perform a
deep-equal on the entire endpoint struct instead of comparing only
Port/Scheme/Interval/ScrapeTimeout so no fields are silently dropped.

In `@docs/reference/argocd.md`:
- Around line 189-190: The table rows for "Metrics.Interval" and
"Metrics.ScrapeTimeout" only contain three pipe-separated cells which breaks the
4-column header (Name | Default | Description | Validation Criteria); update
each row to include a fourth cell (e.g., an appropriate validation note or a
placeholder like "-" or "None") so each line has four columns and matches the
header; ensure the rows for Metrics.Interval and Metrics.ScrapeTimeout now read
with four pipe-separated cells to fix the markdown table rendering.

---

Nitpick comments:
In `@api/v1beta1/argocd_types.go`:
- Around line 449-458: The Interval and ScrapeTimeout fields on
ArgoCDMetricsSpec are unvalidated strings; add a kubebuilder validation pattern
to both fields (Interval and ScrapeTimeout on struct ArgoCDMetricsSpec) to
enforce Prometheus/monitoringv1.Duration format by applying
+kubebuilder:validation:Pattern with the regex
^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
so invalid durations are rejected at admission instead of at scrape time.

In `@bundle/manifests/argoproj.io_argocds.yaml`:
- Around line 1249-1258: The CRD schema currently allows any string for the
interval and scrapeTimeout fields, so add a duration-format regex pattern to
their schema entries: for each metrics block update the properties for
"interval" and "scrapeTimeout" (same field names used in the diff) to include
type: string and a pattern that matches Prometheus duration literals (e.g. use a
regex such as ^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ or the equivalent you
prefer), and apply this change to all eight metrics blocks referenced (the other
occurrences listed in the comment) so invalid durations are rejected at CRD
validation time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f66c88c-7942-45f3-b321-081509aef44c

📥 Commits

Reviewing files that changed from the base of the PR and between 64c4c8b and f18fb1d.

📒 Files selected for processing (15)
  • api/v1alpha1/argocd_conversion.go
  • api/v1alpha1/argocd_conversion_test.go
  • api/v1alpha1/argocd_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • api/v1beta1/argocd_types.go
  • api/v1beta1/zz_generated.deepcopy.go
  • bundle/manifests/argoproj.io_argocds.yaml
  • config/crd/bases/argoproj.io_argocds.yaml
  • controllers/argocd/notifications.go
  • controllers/argocd/notifications_test.go
  • controllers/argocd/prometheus.go
  • controllers/argocd/prometheus_test.go
  • deploy/olm-catalog/argocd-operator/0.19.0/argoproj.io_argocds.yaml
  • docs/reference/argocd.md
  • tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go

Comment thread api/v1alpha1/argocd_conversion.go Outdated
Comment thread config/crd/bases/argoproj.io_argocds.yaml
Comment thread controllers/argocd/notifications_test.go
Comment thread controllers/argocd/prometheus.go
Comment thread docs/reference/argocd.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/reference/argocd.md (1)

189-190: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix table column count mismatch (duplicate issue).

This issue was already identified in a previous review. The Controller options table expects 4 columns but these rows only provide 3 cells each. Add an empty 4th cell to match the table header.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/argocd.md` around lines 189 - 190, The two table rows for
Metrics.Interval and Metrics.ScrapeTimeout have only three cells and must match
the 4-column Controller options table; update the rows that start with
"Metrics.Interval" and "Metrics.ScrapeTimeout" to add an empty 4th cell (i.e.,
append an extra pipe/empty cell) so each row has four pipe-separated columns
matching the table header.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/reference/argocd.md`:
- Around line 189-190: The two table rows for Metrics.Interval and
Metrics.ScrapeTimeout have only three cells and must match the 4-column
Controller options table; update the rows that start with "Metrics.Interval" and
"Metrics.ScrapeTimeout" to add an empty 4th cell (i.e., append an extra
pipe/empty cell) so each row has four pipe-separated columns matching the table
header.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc9469f5-8512-435a-a1b0-28d33dd210a2

📥 Commits

Reviewing files that changed from the base of the PR and between f18fb1d and d96f958.

📒 Files selected for processing (2)
  • api/v1alpha1/argocd_conversion.go
  • docs/reference/argocd.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/v1alpha1/argocd_conversion.go

@jparsai

jparsai commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

It is good for review (for 4 service accounts), It would be better to merge it after #2182 as it will add 2 more service accounts in operator and then I need to add these fields for them as well.

@jparsai
jparsai requested a review from jgwest May 7, 2026 14:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
controllers/argocd/prometheus_test.go (1)

295-555: ⚡ Quick win

Add a notifications ServiceMonitor metrics test for parity.

This suite covers controller/repo/server but not notifications, even though notifications now has component metrics config. A matching test would close coverage on the full feature surface.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/argocd/prometheus_test.go` around lines 295 - 555, Add a new
table-driven unit test (e.g., TestReconcileNotificationsServiceMonitor) that
mirrors the existing
TestReconcileRepoServerServiceMonitor/TestReconcileServerMetricsServiceMonitor
patterns: create ArgoCD test cases with Prometheus enabled/disabled and
notifications metrics set, instantiate the test reconciler (reuse
makeTestReconcilerScheme, makeTestReconcilerClient, makeTestReconciler), call
monitoringv1.AddToScheme and then r.reconcileNotificationsServiceMonitor, and
assert presence/absence of the ServiceMonitor and that its endpoint
Interval/ScrapeTimeout match the ArgoCD.Spec.Notifications.Metrics values; look
up the created ServiceMonitor by the same naming convention used elsewhere
(e.g., fmt.Sprintf("%s-notifications-metrics", test.argocd.Name)) and use the
same assertion style as TestReconcileRepoServerServiceMonitor to validate
endpoints.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/v1alpha1/argocd_types.go`:
- Around line 364-372: Add CRD validation markers to ArgoCDMetricsSpec so
Interval and ScrapeTimeout only accept valid Go duration strings: add
kubebuilder validation comments above the Interval and ScrapeTimeout fields in
ArgoCDMetricsSpec (e.g., // +kubebuilder:validation:Pattern="<regex>") using a
regex that matches Go time durations such as
'^(\d+(\.\d+)?(ns|us|µs|ms|s|m|h))+$' to prevent invalid durations from being
stored in the CR and failing ServiceMonitor reconciliation.

In `@docs/reference/argocd.md`:
- Around line 189-190: The two new table rows for Metrics.Interval and
Metrics.ScrapeTimeout have trailing table pipes that trigger MD055; edit the
rows referencing "Metrics.Interval" and "Metrics.ScrapeTimeout" in
docs/reference/argocd.md to remove the trailing pipe(s) so they match the file's
existing table style (no unexpected trailing pipe) and keep the same number of
columns/pipe separators as the surrounding rows.

---

Nitpick comments:
In `@controllers/argocd/prometheus_test.go`:
- Around line 295-555: Add a new table-driven unit test (e.g.,
TestReconcileNotificationsServiceMonitor) that mirrors the existing
TestReconcileRepoServerServiceMonitor/TestReconcileServerMetricsServiceMonitor
patterns: create ArgoCD test cases with Prometheus enabled/disabled and
notifications metrics set, instantiate the test reconciler (reuse
makeTestReconcilerScheme, makeTestReconcilerClient, makeTestReconciler), call
monitoringv1.AddToScheme and then r.reconcileNotificationsServiceMonitor, and
assert presence/absence of the ServiceMonitor and that its endpoint
Interval/ScrapeTimeout match the ArgoCD.Spec.Notifications.Metrics values; look
up the created ServiceMonitor by the same naming convention used elsewhere
(e.g., fmt.Sprintf("%s-notifications-metrics", test.argocd.Name)) and use the
same assertion style as TestReconcileRepoServerServiceMonitor to validate
endpoints.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccfd3225-4050-495b-bbae-a63053d19f77

📥 Commits

Reviewing files that changed from the base of the PR and between d96f958 and 47beae9.

📒 Files selected for processing (15)
  • api/v1alpha1/argocd_conversion.go
  • api/v1alpha1/argocd_conversion_test.go
  • api/v1alpha1/argocd_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • api/v1beta1/argocd_types.go
  • api/v1beta1/zz_generated.deepcopy.go
  • bundle/manifests/argoproj.io_argocds.yaml
  • config/crd/bases/argoproj.io_argocds.yaml
  • controllers/argocd/notifications.go
  • controllers/argocd/notifications_test.go
  • controllers/argocd/prometheus.go
  • controllers/argocd/prometheus_test.go
  • deploy/olm-catalog/argocd-operator/0.19.0/argoproj.io_argocds.yaml
  • docs/reference/argocd.md
  • tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go
✅ Files skipped from review due to trivial changes (2)
  • api/v1alpha1/zz_generated.deepcopy.go
  • api/v1beta1/zz_generated.deepcopy.go
🚧 Files skipped from review as they are similar to previous changes (9)
  • controllers/argocd/notifications.go
  • controllers/argocd/prometheus.go
  • api/v1alpha1/argocd_conversion_test.go
  • deploy/olm-catalog/argocd-operator/0.19.0/argoproj.io_argocds.yaml
  • api/v1beta1/argocd_types.go
  • controllers/argocd/notifications_test.go
  • tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go
  • api/v1alpha1/argocd_conversion.go
  • bundle/manifests/argoproj.io_argocds.yaml

Comment thread api/v1alpha1/argocd_types.go
Comment thread docs/reference/argocd.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/reference/argocd.md (1)

189-190: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix Controller table column mismatch for the new metrics rows.

These rows still have 3 cells under a 4-column table header, which breaks markdown table rendering/linting.

Suggested patch
-Metrics.Interval | [Empty] | Prometheus scrape interval for the Application Controller ServiceMonitor. If empty, Prometheus uses its default.
-Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application Controller ServiceMonitor. If empty, Prometheus uses its default.
+Metrics.Interval | [Empty] | Prometheus scrape interval for the Application Controller ServiceMonitor. If empty, Prometheus uses its default. | -
+Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application Controller ServiceMonitor. If empty, Prometheus uses its default. | -
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/argocd.md` around lines 189 - 190, The two new metric rows
("Metrics.Interval" and "Metrics.ScrapeTimeout") only have three table cells
while the table header expects four, breaking markdown; update those rows in
docs/reference/argocd.md so each row has four pipe-separated cells (for example
by adding the missing fourth cell—either the appropriate component like
"Application Controller" or an explicit empty cell) so the table columns align
with the header.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/reference/argocd.md`:
- Around line 189-190: The two new metric rows ("Metrics.Interval" and
"Metrics.ScrapeTimeout") only have three table cells while the table header
expects four, breaking markdown; update those rows in docs/reference/argocd.md
so each row has four pipe-separated cells (for example by adding the missing
fourth cell—either the appropriate component like "Application Controller" or an
explicit empty cell) so the table columns align with the header.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f2d44d1-83e4-48de-aecc-c3862d9e80bf

📥 Commits

Reviewing files that changed from the base of the PR and between 47beae9 and ebd9768.

📒 Files selected for processing (1)
  • docs/reference/argocd.md

Comment thread api/v1alpha1/argocd_types.go Outdated
Comment thread api/v1alpha1/argocd_types.go Outdated
Comment thread api/v1alpha1/argocd_types.go Outdated
Comment thread api/v1alpha1/argocd_types.go Outdated
Comment thread api/v1beta1/argocd_types.go Outdated
Comment thread controllers/argocd/notifications.go
Comment thread controllers/argocd/notifications_test.go
Comment thread controllers/argocd/prometheus.go
jparsai added 4 commits May 20, 2026 15:13
Assisted by: Cursor

Signed-off-by: Jayendra Parsai <jparsai@redhat.com>
Signed-off-by: Jayendra Parsai <jparsai@redhat.com>
Signed-off-by: Jayendra Parsai <jparsai@redhat.com>
Signed-off-by: Jayendra Parsai <jparsai@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
docs/reference/argocd.md (1)

190-191: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add the missing 4th table cell in Controller metrics rows.

These two rows are still 3-cell rows under a 4-column table, which triggers markdownlint (MD056) and can render incorrectly.

Suggested patch
-Metrics.Interval | [Empty] | Prometheus scrape interval for the Application Controller ServiceMonitor. If empty, Prometheus uses its default.
-Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application Controller ServiceMonitor. If empty, Prometheus uses its default.
+Metrics.Interval | [Empty] | Prometheus scrape interval for the Application Controller ServiceMonitor. If empty, Prometheus uses its default. | -
+Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application Controller ServiceMonitor. If empty, Prometheus uses its default. | -
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/argocd.md` around lines 190 - 191, The table rows for
"Metrics.Interval" and "Metrics.ScrapeTimeout" are missing the 4th table cell
causing a 3-cell row in a 4-column table; update each row (the lines containing
"Metrics.Interval | [Empty] | Prometheus scrape interval for the Application
Controller ServiceMonitor. If empty, Prometheus uses its default." and
"Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application
Controller ServiceMonitor. If empty, Prometheus uses its default.") to include a
fourth cell (e.g., add " | " followed by an empty placeholder like "-" or
"[Empty]") so each row has four pipe-separated cells and the table validates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go`:
- Around line 160-247: The ServiceMonitor checks ignore k8sClient.Get errors and
assert ScrapeTimeout outside Eventually, causing stale reads and flakiness;
update each Eventually for controllerSM, repoSM, serverSM and notifSM (the
functions that currently call k8sClient.Get) to return both the Endpoint
Interval and ScrapeTimeout (or a struct/tuple-like sentinel) and propagate Get
errors by returning a distinct value when Get fails or endpoints are empty, then
move the ScrapeTimeout assertions inside the same Eventually so both Interval
and ScrapeTimeout are asserted atomically (i.e., replace separate Expect(...)
calls with a single Eventually that compares both values together for
controllerSM, repoSM, serverSM and notifSM).

---

Duplicate comments:
In `@docs/reference/argocd.md`:
- Around line 190-191: The table rows for "Metrics.Interval" and
"Metrics.ScrapeTimeout" are missing the 4th table cell causing a 3-cell row in a
4-column table; update each row (the lines containing "Metrics.Interval |
[Empty] | Prometheus scrape interval for the Application Controller
ServiceMonitor. If empty, Prometheus uses its default." and
"Metrics.ScrapeTimeout | [Empty] | Prometheus scrape timeout for the Application
Controller ServiceMonitor. If empty, Prometheus uses its default.") to include a
fourth cell (e.g., add " | " followed by an empty placeholder like "-" or
"[Empty]") so each row has four pipe-separated cells and the table validates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 82448b3e-bfac-4495-a366-6f24f3886a00

📥 Commits

Reviewing files that changed from the base of the PR and between ebd9768 and debb12c.

📒 Files selected for processing (15)
  • api/v1alpha1/argocd_conversion.go
  • api/v1alpha1/argocd_conversion_test.go
  • api/v1alpha1/argocd_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • api/v1beta1/argocd_types.go
  • api/v1beta1/zz_generated.deepcopy.go
  • bundle/manifests/argoproj.io_argocds.yaml
  • config/crd/bases/argoproj.io_argocds.yaml
  • controllers/argocd/notifications.go
  • controllers/argocd/notifications_test.go
  • controllers/argocd/prometheus.go
  • controllers/argocd/prometheus_test.go
  • deploy/olm-catalog/argocd-operator/0.19.0/argoproj.io_argocds.yaml
  • docs/reference/argocd.md
  • tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go
✅ Files skipped from review due to trivial changes (1)
  • api/v1alpha1/zz_generated.deepcopy.go

Comment thread tests/ginkgo/parallel/1-126_validate_servicemonitor_metrics_config_test.go Outdated
Signed-off-by: Jayendra Parsai <jparsai@redhat.com>
@jparsai

jparsai commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

Please wait for me to update principal and agent serviceMonitors as my other PR is merged now.

Assisted by: Cursor

Signed-off-by: Jayendra Parsai <jparsai@redhat.com>
@jparsai

jparsai commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

Please wait for me to update principal and agent serviceMonitors as my other PR is merged now.

It is updated, PTAL.

@jgwest jgwest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @jparsai!

@jgwest
jgwest merged commit bc9df57 into argoproj-labs:master May 21, 2026
9 checks passed
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.

2 participants