Skip to content

NETOBSERV-2655: additionalIncludeList field to append metrics to default#2546

Merged
Amoghrd merged 2 commits intonetobserv:mainfrom
Amoghrd:append-includeList
Apr 23, 2026
Merged

NETOBSERV-2655: additionalIncludeList field to append metrics to default#2546
Amoghrd merged 2 commits intonetobserv:mainfrom
Amoghrd:append-includeList

Conversation

@Amoghrd
Copy link
Copy Markdown
Member

@Amoghrd Amoghrd commented Mar 13, 2026

Description

Adds a new additionalIncludeList field to allow appending metrics to the defaults without breaking backward compatibility.

Problem: The original includeList field overwrites the default metrics list. Users who want to add a few extra metrics need to specify all defaults + their additions, which is cumbersome.

Solution:

  • Keep includeList behavior unchanged (overwrites defaults) - backwards compatible
  • Add new additionalIncludeList field that appends to defaults
  • Fields are mutually exclusive - if both are set, includeList takes precedence and a validation warning is shown

Usage Examples:

Append to defaults:

spec:
  processor:
    metrics:
      additionalIncludeList:
        - namespace_egress_bytes_total
        - namespace_ingress_bytes_total

Override defaults (existing behavior):

spec:
  processor:
    metrics:
      includeList:
        - node_ingress_bytes_total

Changes

  • Added additionalIncludeList field to FLPMetrics API
  • Updated GetIncludeList() to support the new field
  • Added validation to warn when both fields are set
  • Added comprehensive tests for new functionality
  • Updated CRDs, bundle, and documentation

Dependencies

n/a

Checklist

  • Does the changes in PR need specific configuration or environment set up for testing?
    • if so please describe it in PR description.
  • I have added thorough unit tests for the change.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Summary by CodeRabbit

  • New Features

    • Add an optional "additional include list" to append extra metrics to the default metrics; ignored when an explicit include list is provided.
    • Added a runtime validation warning describing the mutual-exclusivity/precedence between the two lists.
  • Documentation

    • Docs, CRD schema, and UI descriptors updated to document the new field, allowed values, and behavior.
  • Tests

    • Added unit tests for appending, deduplication, and precedence between include lists.

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

openshift-ci-robot commented Mar 13, 2026

@Amoghrd: This pull request references NETOBSERV-2655 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Description

Instead of overwriting metrics when added to includeList, now we append them to the default list.
Also updated the tests based on these changes

Dependencies

n/a

Checklist

  • Does the changes in PR need specific configuration or environment set up for testing?
    • if so please describe it in PR description.
  • I have added thorough unit tests for the change.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@Amoghrd Amoghrd force-pushed the append-includeList branch 2 times, most recently from 4221dd0 to 735d68e Compare March 13, 2026 15:09
@Amoghrd Amoghrd requested a review from jotak March 13, 2026 15:10
@Amoghrd Amoghrd force-pushed the append-includeList branch 2 times, most recently from e341726 to 2999d48 Compare March 13, 2026 15:24
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.91%. Comparing base (6ad9ed9) to head (b25daa9).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
api/flowcollector/v1beta2/zz_generated.deepcopy.go 0.00% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2546      +/-   ##
==========================================
- Coverage   72.07%   71.91%   -0.17%     
==========================================
  Files         105      105              
  Lines       10924    10943      +19     
==========================================
- Hits         7874     7870       -4     
- Misses       2565     2584      +19     
- Partials      485      489       +4     
Flag Coverage Δ
unittests 71.91% <63.15%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...flowcollector/v1beta2/flowcollector_alert_types.go 97.72% <100.00%> (+0.13%) ⬆️
api/flowcollector/v1beta2/flowcollector_types.go 100.00% <ø> (ø)
...lector/v1beta2/flowcollector_validation_webhook.go 72.67% <100.00%> (+0.58%) ⬆️
api/flowcollector/v1beta2/zz_generated.deepcopy.go 35.58% <0.00%> (-0.26%) ⬇️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

We can't change the behaviour of the existing API, it would be a breaking change.
We need instead to create a new setting, such as "additionalIncludeList", and keep the existing as it is.

@Amoghrd
Copy link
Copy Markdown
Member Author

Amoghrd commented Mar 16, 2026

Sounds good, will do that

@Amoghrd Amoghrd force-pushed the append-includeList branch 2 times, most recently from c089707 to e970bd3 Compare March 16, 2026 14:07
@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

@Amoghrd: This pull request references NETOBSERV-2655 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

@/tmp/pr_body.md

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@Amoghrd Amoghrd changed the title NETOBSERV-2655: Append includeList NETOBSERV-2655: additionalIncludeList field to append metrics to default Mar 16, 2026
Comment thread api/flowcollector/v1beta2/flowcollector_alert_types.go Outdated
Copy link
Copy Markdown
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

just a small comment, LGTM otherwise

jotak
jotak previously approved these changes Mar 18, 2026
Copy link
Copy Markdown
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

Thanks @Amoghrd , lgtm

@openshift-ci openshift-ci Bot added the lgtm label Mar 18, 2026
@oliver-smakal
Copy link
Copy Markdown

/ok-to-test

@openshift-ci openshift-ci Bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

New images:

quay.io/netobserv/network-observability-operator:aa88674
quay.io/netobserv/network-observability-operator-bundle:v0.0.0-sha-aa88674
quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-aa88674

They will expire in two weeks.

To deploy this build:

# Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:aa88674 make deploy

# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-sha-aa88674

Or as a Catalog Source:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: netobserv-dev
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-aa88674
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@oliver-smakal
Copy link
Copy Markdown

/label qe-approved

@openshift-ci openshift-ci Bot added the qe-approved QE has approved this pull request label Apr 9, 2026
@github-actions github-actions Bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Apr 9, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Adds additionalIncludeList to FlowCollector metrics config; when includeList is nil, defaults are merged with additionalIncludeList (deduped); when includeList is set it takes precedence and additionalIncludeList is ignored. Changes touch types, validation, tests, CRDs, docs, and manifests.

Changes

Cohort / File(s) Summary
Core types & logic
api/flowcollector/v1beta2/flowcollector_types.go, api/flowcollector/v1beta2/flowcollector_alert_types.go
Added AdditionalIncludeList *[]FLPMetric to FLPMetrics. GetIncludeList() now appends AdditionalIncludeList to the chosen default include list when IncludeList is nil, deduping entries; when IncludeList is non-nil it is used exclusively.
Validation & messages
api/flowcollector/v1beta2/flowcollector_validation_webhook.go, api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go, api/flowcollector/v1beta2/validation_messages.go
Added validateFLPMetricsIncludeLists() and exported MetricsIncludeListWarning; validator emits a warning if both includeList and additionalIncludeList are set. Test added to assert the warning.
CRD & operator manifests
config/crd/bases/flows.netobserv.io_flowcollectors.yaml, bundle/manifests/flows.netobserv.io_flowcollectors.yaml, helm/crds/flows.netobserv.io_flowcollectors.yaml, bundle/manifests/netobserv-operator.clusterserviceversion.yaml
CRD schemas and CSV descriptor extended with spec.processor.metrics.additionalIncludeList (array of enum-constrained metric names). Documentation in CRDs/CSV describes append semantics and mutual-exclusivity with includeList.
Tests (pipeline)
internal/controller/flp/flp_pipeline_builder_test.go
Added helper and tests verifying append behavior, deduplication, empty/nil handling, and precedence of IncludeList over AdditionalIncludeList.
Documentation
docs/FlowCollector.md
Documented spec.processor.metrics.additionalIncludeList, allowed enum values, append semantics, and mutual-exclusivity with includeList.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change: adding an additionalIncludeList field to append metrics to defaults, which is the core objective of the PR.
Description check ✅ Passed Description is comprehensive, addressing the problem, solution, usage examples, changes made, and completing all checklist items including unit tests and QE requirements.

✏️ 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.

@Amoghrd Amoghrd force-pushed the append-includeList branch from 182b09c to e29c833 Compare April 9, 2026 13:19
@Amoghrd
Copy link
Copy Markdown
Member Author

Amoghrd commented Apr 9, 2026

(Rebased without any changes)
Could I get LGTM, approve labels for merge? TIA!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
api/flowcollector/v1beta2/flowcollector_validation_webhook.go (1)

443-445: Extract this warning text into a shared constant.

The same long message is duplicated across validator and tests; centralizing it will prevent drift and brittle string updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/flowcollector/v1beta2/flowcollector_validation_webhook.go` around lines
443 - 445, Extract the duplicated long warning into a single exported constant
(e.g., MetricsIncludeListWarning) in a shared package file (like a new
messages.go or constants.go in the same package as
flowcollector_validation_webhook.go), set its value to the provided
multi-sentence text about spec.processor.metrics.includeList vs
additionalIncludeList, then replace the inline string occurrences in
flowcollector_validation_webhook.go and in the tests with that constant
(referencing MetricsIncludeListWarning) so both validator and tests use the same
centralized message.
internal/controller/flp/flp_pipeline_builder_test.go (1)

220-237: Add edge-case tests for AdditionalIncludeList dedup/empty behavior.

This test covers the happy path, but it does not lock in empty-list and dedup behavior (including overlap with defaults), which is part of the merge contract.

Suggested test additions
+func TestMergeMetricsConfiguration_WithAdditionalList_Empty(t *testing.T) {
+	assert := assert.New(t)
+	cfg := getConfig()
+	cfg.Processor.Metrics.AdditionalIncludeList = &[]flowslatest.FLPMetric{}
+	b := monoBuilder("namespace", &cfg)
+	scm, _, dcm, err := b.configMaps()
+	assert.NoError(err)
+	cfs, _ := validatePipelineConfig(t, scm, dcm)
+	names := getSortedMetricsNames(cfs.Parameters[5].Encode.Prom.Metrics)
+	assert.NotEmpty(names) // defaults still present
+}
+
+func TestMergeMetricsConfiguration_WithAdditionalList_Dedup(t *testing.T) {
+	assert := assert.New(t)
+	cfg := getConfig()
+	cfg.Processor.Metrics.AdditionalIncludeList = &[]flowslatest.FLPMetric{
+		"node_ingress_bytes_total", // already default
+		"node_ingress_bytes_total", // duplicate in additional
+	}
+	b := monoBuilder("namespace", &cfg)
+	scm, _, dcm, err := b.configMaps()
+	assert.NoError(err)
+	cfs, _ := validatePipelineConfig(t, scm, dcm)
+	names := getSortedMetricsNames(cfs.Parameters[5].Encode.Prom.Metrics)
+	count := 0
+	for _, n := range names {
+		if n == "node_ingress_bytes_total" {
+			count++
+		}
+	}
+	assert.Equal(1, count)
+}

As per coding guidelines, **/*_test.go should include edge-case coverage (empty, nil values).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/controller/flp/flp_pipeline_builder_test.go` around lines 220 - 237,
Add edge-case tests for AdditionalIncludeList to assert dedup and empty/nil
behavior: create tests similar to
TestMergeMetricsConfiguration_WithAdditionalList that set
cfg.Processor.Metrics.AdditionalIncludeList to nil, to an empty slice, and to a
slice with duplicates and overlaps with default metrics; then call
monoBuilder(...).configMaps(), validatePipelineConfig(...), and inspect
cfs.Parameters[5].Encode.Prom.Metrics (using getSortedMetricsNames) to assert
that nil/empty results in only defaults and that duplicates/overlaps are
deduplicated (no duplicate names) while still including defaults and the unique
additional entries. Ensure assertions cover presence/absence of specific metric
names and that Prom.Prefix remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@api/flowcollector/v1beta2/flowcollector_validation_webhook.go`:
- Around line 443-445: Extract the duplicated long warning into a single
exported constant (e.g., MetricsIncludeListWarning) in a shared package file
(like a new messages.go or constants.go in the same package as
flowcollector_validation_webhook.go), set its value to the provided
multi-sentence text about spec.processor.metrics.includeList vs
additionalIncludeList, then replace the inline string occurrences in
flowcollector_validation_webhook.go and in the tests with that constant
(referencing MetricsIncludeListWarning) so both validator and tests use the same
centralized message.

In `@internal/controller/flp/flp_pipeline_builder_test.go`:
- Around line 220-237: Add edge-case tests for AdditionalIncludeList to assert
dedup and empty/nil behavior: create tests similar to
TestMergeMetricsConfiguration_WithAdditionalList that set
cfg.Processor.Metrics.AdditionalIncludeList to nil, to an empty slice, and to a
slice with duplicates and overlaps with default metrics; then call
monoBuilder(...).configMaps(), validatePipelineConfig(...), and inspect
cfs.Parameters[5].Encode.Prom.Metrics (using getSortedMetricsNames) to assert
that nil/empty results in only defaults and that duplicates/overlaps are
deduplicated (no duplicate names) while still including defaults and the unique
additional entries. Ensure assertions cover presence/absence of specific metric
names and that Prom.Prefix remains unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97211d4c-8494-4e52-97f8-c4dc0a429db8

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad9ed9 and e29c833.

⛔ Files ignored due to path filters (1)
  • api/flowcollector/v1beta2/zz_generated.deepcopy.go is excluded by !**/zz_generated.deepcopy.go
📒 Files selected for processing (10)
  • api/flowcollector/v1beta2/flowcollector_alert_types.go
  • api/flowcollector/v1beta2/flowcollector_types.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go
  • bundle/manifests/flows.netobserv.io_flowcollectors.yaml
  • bundle/manifests/netobserv-operator.clusterserviceversion.yaml
  • config/crd/bases/flows.netobserv.io_flowcollectors.yaml
  • docs/FlowCollector.md
  • helm/crds/flows.netobserv.io_flowcollectors.yaml
  • internal/controller/flp/flp_pipeline_builder_test.go

@Amoghrd Amoghrd force-pushed the append-includeList branch from e29c833 to 0fee230 Compare April 9, 2026 13:50
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/controller/flp/flp_pipeline_builder_test.go (1)

220-323: Consider extracting a small helper to reduce repeated setup in these tests.

monoBuilder/configMaps/validatePipelineConfig/getSortedMetricsNames is repeated in each test; a helper would keep these cases shorter and easier to evolve.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/controller/flp/flp_pipeline_builder_test.go` around lines 220 - 323,
Tests repeatedly build the pipeline and extract sorted metric names using
monoBuilder, configMaps, validatePipelineConfig and getSortedMetricsNames;
extract that repeated setup into a small helper (e.g., func
buildAndGetMetricNames(cfg *flowslatest.Config) ([]string, *ConfigStructType) or
similar) that runs monoBuilder(...), calls b.configMaps(), asserts no error,
calls validatePipelineConfig and returns
getSortedMetricsNames(cfs.Parameters[5].Encode.Prom.Metrics) plus any needed cfs
for assertions; update each TestMergeMetricsConfiguration_* to call this helper
to reduce duplication and keep assertions focused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/FlowCollector.md`:
- Line 11610: Update the documentation text for the additionalIncludeList vs
includeList mutual-exclusivity to state that not only is additionalIncludeList
ignored when includeList is set, but a validation warning is emitted at apply
time; specifically modify the sentence referencing additionalIncludeList and
includeList in FlowCollector.md so it mentions the validation warning users will
see when both fields are provided.

---

Nitpick comments:
In `@internal/controller/flp/flp_pipeline_builder_test.go`:
- Around line 220-323: Tests repeatedly build the pipeline and extract sorted
metric names using monoBuilder, configMaps, validatePipelineConfig and
getSortedMetricsNames; extract that repeated setup into a small helper (e.g.,
func buildAndGetMetricNames(cfg *flowslatest.Config) ([]string,
*ConfigStructType) or similar) that runs monoBuilder(...), calls b.configMaps(),
asserts no error, calls validatePipelineConfig and returns
getSortedMetricsNames(cfs.Parameters[5].Encode.Prom.Metrics) plus any needed cfs
for assertions; update each TestMergeMetricsConfiguration_* to call this helper
to reduce duplication and keep assertions focused.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 107c8d19-2182-48cf-9029-0d355a8b83fd

📥 Commits

Reviewing files that changed from the base of the PR and between e29c833 and 0fee230.

⛔ Files ignored due to path filters (1)
  • api/flowcollector/v1beta2/zz_generated.deepcopy.go is excluded by !**/zz_generated.deepcopy.go
📒 Files selected for processing (11)
  • api/flowcollector/v1beta2/flowcollector_alert_types.go
  • api/flowcollector/v1beta2/flowcollector_types.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go
  • api/flowcollector/v1beta2/validation_messages.go
  • bundle/manifests/flows.netobserv.io_flowcollectors.yaml
  • bundle/manifests/netobserv-operator.clusterserviceversion.yaml
  • config/crd/bases/flows.netobserv.io_flowcollectors.yaml
  • docs/FlowCollector.md
  • helm/crds/flows.netobserv.io_flowcollectors.yaml
  • internal/controller/flp/flp_pipeline_builder_test.go
✅ Files skipped from review due to trivial changes (1)
  • bundle/manifests/netobserv-operator.clusterserviceversion.yaml
🚧 Files skipped from review as they are similar to previous changes (4)
  • api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go
  • helm/crds/flows.netobserv.io_flowcollectors.yaml
  • bundle/manifests/flows.netobserv.io_flowcollectors.yaml
  • config/crd/bases/flows.netobserv.io_flowcollectors.yaml

Comment thread docs/FlowCollector.md
@Amoghrd Amoghrd force-pushed the append-includeList branch from 0fee230 to b71c894 Compare April 9, 2026 14:05
@Amoghrd Amoghrd force-pushed the append-includeList branch from b71c894 to b25daa9 Compare April 9, 2026 15:05
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/controller/flp/flp_pipeline_builder_test.go (1)

118-118: Optional: remove hardcoded Prometheus parameter index from the helper.

Using cfs.Parameters[5] is brittle if pipeline parameter ordering changes. Resolve the Prometheus parameter by name before extracting metrics.

♻️ Proposed refactor
 func buildAndGetMetricNames(t *testing.T, cfg *flowslatest.FlowCollectorSpec) ([]string, *config.Root) {
 	b := monoBuilder("namespace", cfg)
 	scm, _, dcm, err := b.configMaps()
 	assert.NoError(t, err)
 	cfs, _ := validatePipelineConfig(t, scm, dcm)
-	names := getSortedMetricsNames(cfs.Parameters[5].Encode.Prom.Metrics)
+	promIdx := -1
+	for i, p := range cfs.Parameters {
+		if p.Name == "prometheus" {
+			promIdx = i
+			break
+		}
+	}
+	assert.NotEqual(t, -1, promIdx, "prometheus stage params not found")
+	names := getSortedMetricsNames(cfs.Parameters[promIdx].Encode.Prom.Metrics)
 	return names, cfs
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/controller/flp/flp_pipeline_builder_test.go` at line 118, The test
currently grabs Prometheus params by position (cfs.Parameters[5]) which is
brittle; modify the test to locate the Prometheus parameter by its name/key
before calling getSortedMetricsNames so ordering changes won't break the test.
Specifically, iterate or use a helper to find the parameter with the Prometheus
identifier in cfs.Parameters (the element whose Encode.Prom is populated), then
pass that parameter's Encode.Prom.Metrics into getSortedMetricsNames rather than
using the hardcoded index; update any local helper used in
flp_pipeline_builder_test.go to perform lookups by name instead of index.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/controller/flp/flp_pipeline_builder_test.go`:
- Line 118: The test currently grabs Prometheus params by position
(cfs.Parameters[5]) which is brittle; modify the test to locate the Prometheus
parameter by its name/key before calling getSortedMetricsNames so ordering
changes won't break the test. Specifically, iterate or use a helper to find the
parameter with the Prometheus identifier in cfs.Parameters (the element whose
Encode.Prom is populated), then pass that parameter's Encode.Prom.Metrics into
getSortedMetricsNames rather than using the hardcoded index; update any local
helper used in flp_pipeline_builder_test.go to perform lookups by name instead
of index.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5e659d93-7ab3-4b65-9d0c-c6bb36d35f96

📥 Commits

Reviewing files that changed from the base of the PR and between 0fee230 and b25daa9.

⛔ Files ignored due to path filters (1)
  • api/flowcollector/v1beta2/zz_generated.deepcopy.go is excluded by !**/zz_generated.deepcopy.go
📒 Files selected for processing (11)
  • api/flowcollector/v1beta2/flowcollector_alert_types.go
  • api/flowcollector/v1beta2/flowcollector_types.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go
  • api/flowcollector/v1beta2/validation_messages.go
  • bundle/manifests/flows.netobserv.io_flowcollectors.yaml
  • bundle/manifests/netobserv-operator.clusterserviceversion.yaml
  • config/crd/bases/flows.netobserv.io_flowcollectors.yaml
  • docs/FlowCollector.md
  • helm/crds/flows.netobserv.io_flowcollectors.yaml
  • internal/controller/flp/flp_pipeline_builder_test.go
✅ Files skipped from review due to trivial changes (3)
  • api/flowcollector/v1beta2/flowcollector_alert_types.go
  • api/flowcollector/v1beta2/validation_messages.go
  • docs/FlowCollector.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • api/flowcollector/v1beta2/flowcollector_types.go
  • api/flowcollector/v1beta2/flowcollector_validation_webhook_test.go
  • helm/crds/flows.netobserv.io_flowcollectors.yaml
  • bundle/manifests/flows.netobserv.io_flowcollectors.yaml
  • api/flowcollector/v1beta2/flowcollector_validation_webhook.go
  • config/crd/bases/flows.netobserv.io_flowcollectors.yaml

@Amoghrd Amoghrd added the needs-review Tells that the PR needs a review label Apr 9, 2026
@Amoghrd Amoghrd added needs-review Tells that the PR needs a review and removed needs-review Tells that the PR needs a review labels Apr 20, 2026
Copy link
Copy Markdown
Member

@jpinsonneau jpinsonneau left a comment

Choose a reason for hiding this comment

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

LGTM in terms of code

@openshift-ci openshift-ci Bot added the lgtm label Apr 23, 2026
@Amoghrd Amoghrd added approved and removed needs-review Tells that the PR needs a review labels Apr 23, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Amoghrd Amoghrd merged commit 6a68821 into netobserv:main Apr 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants