Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,16 @@ type NodeExporterCollectorConfig struct {
// Enable when you need visibility into kernel softirq processing across CPUs.
// +optional
Softirqs NodeExporterCollectorSoftirqsConfig `json:"softirqs,omitempty,omitzero"`
// interrupts configures the interrupts collector, which exposes interrupt counts
// from /proc/interrupts.
// interrupts is optional.
// When omitted, this means no opinion and the platform is left to choose a reasonable default,
// which is subject to change over time. The current default is disabled.
// The interrupts collector can produce a large number of metrics depending on the hardware
// and interrupt sources present. When enabled, use the collect.include list to filter
// which interrupt lines are collected.
// +optional
Interrupts NodeExporterCollectorInterruptsConfig `json:"interrupts,omitempty,omitzero"`
}

// NodeExporterCollectorCpufreqConfig provides configuration for the cpufreq collector
Expand Down Expand Up @@ -689,6 +699,65 @@ type NodeExporterCollectorSoftirqsConfig struct {
CollectionPolicy NodeExporterCollectorCollectionPolicy `json:"collectionPolicy,omitempty"`
}

// NodeExporterCollectorInterruptsConfig provides configuration for the interrupts collector
// of the node-exporter agent. The interrupts collector exposes interrupt counts
// from /proc/interrupts.
// It is disabled by default.
// The interrupts collector can produce a large number of metrics depending on the hardware
// and interrupt sources present. When enabled, use the collect.include list to filter
// which interrupt lines are collected.
// When collectionPolicy is DoNotCollect, the collect field must not be set.
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect is forbidden when collectionPolicy is not Collect"
// +union
type NodeExporterCollectorInterruptsConfig struct {
// collectionPolicy declares whether the interrupts collector collects metrics.
// This field is required.
// Valid values are "Collect" and "DoNotCollect".
// When set to "Collect", the interrupts collector is active and interrupt statistics are collected.
// When set to "DoNotCollect", the interrupts collector is inactive and the collect field must not be set.
// +unionDiscriminator
// +required
CollectionPolicy NodeExporterCollectorCollectionPolicy `json:"collectionPolicy,omitempty"`
// collect contains configuration options that apply only when the interrupts collector is actively collecting metrics
// (i.e. when collectionPolicy is Collect).
// collect is optional and may be omitted even when collectionPolicy is Collect.
// collect may only be set when collectionPolicy is Collect.
// When set, at least one field must be specified within collect.
// +unionMember
// +optional
Collect NodeExporterCollectorInterruptsCollectConfig `json:"collect,omitzero,omitempty"`
Comment on lines +721 to +728

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. collect omits omit behavior 📜 Skill insight ✧ Quality

The new optional InterruptsConfig.Collect field is documented as optional, but does not explain
what happens when it is omitted (defaults/behavior). This violates the requirement that new optional
fields document omit behavior.
Agent Prompt
## Issue description
`Collect` is marked `+optional` but its comment does not describe the behavior when the field is omitted (e.g., what defaults apply / what is collected).

## Issue Context
Optional-field documentation must clearly state omit behavior ("When omitted...", "Defaults to..."), especially for API/CRD fields.

## Fix Focus Areas
- config/v1alpha1/types_cluster_monitoring.go[721-728]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

}

// NodeExporterCollectorInterruptsCollectConfig holds configuration options for the interrupts collector
// when it is actively collecting metrics. At least one field must be specified.
// +kubebuilder:validation:MinProperties=1
type NodeExporterCollectorInterruptsCollectConfig struct {
// include is a list of regular expression patterns that select which interrupt lines to collect.
// include is optional.
// Each line in /proc/interrupts is matched against the same string node-exporter uses:
// the IRQ name, info, and devices fields joined with ";", for example "LOC;77;IO-APIC 2-edge ...".
// Patterns are combined with OR into a single expression anchored on both ends,
// so each pattern must match the entire string (use ".*" where needed).
// An empty list or omitting include collects all interrupt lines.
// Each entry must be at least 1 character and at most 1024 characters.
// Maximum length for this list is 50.
// Minimum length for this list is 1.
// Entries in this list must be unique.
// +kubebuilder:validation:MaxItems=50
// +kubebuilder:validation:MinItems=1
// +listType=set
// +optional
Include []NodeExporterInterruptsIncludePattern `json:"include,omitempty"`
Comment on lines +741 to +750

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Allow the documented empty include list.

Line 741 says an empty list collects all interrupt lines, but MinItems=1 rejects include: []. Permit empty lists (remove MinItems) or change the documented API behavior.

  • config/v1alpha1/types_cluster_monitoring.go#L741-L750: remove the MinItems=1 validation marker if empty lists are intended to collect all lines.
  • payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml#L2215-L2232: regenerate the CRD so it no longer requires one include item.
📍 Affects 2 files
  • config/v1alpha1/types_cluster_monitoring.go#L741-L750 (this comment)
  • payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml#L2215-L2232
🤖 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 `@config/v1alpha1/types_cluster_monitoring.go` around lines 741 - 750, Allow an
empty Include list as documented by removing the MinItems=1 validation marker
from NodeExporterInterruptsIncludePattern in
config/v1alpha1/types_cluster_monitoring.go:741-750. Regenerate
payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml:2215-2232
so the CRD no longer enforces a minimum item count.

}

// NodeExporterInterruptsIncludePattern is a string that is interpreted as a Go regular expression
// pattern by the controller to match interrupt line names.
// Invalid regular expressions will cause a controller-level error at runtime.
// Must be at least 1 character and at most 1024 characters.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=1024
type NodeExporterInterruptsIncludePattern string

// MonitoringPluginConfig provides configuration options for the monitoring plugin
// that runs as a dynamic plugin of the OpenShift web console.
// The monitoring plugin provides the monitoring UI in the OpenShift web console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,72 @@ spec:
required:
- collectionPolicy
type: object
interrupts:
description: |-
interrupts configures the interrupts collector, which exposes interrupt counts
from /proc/interrupts.
interrupts is optional.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time. The current default is disabled.
The interrupts collector can produce a large number of metrics depending on the hardware
and interrupt sources present. When enabled, use the collect.include list to filter
which interrupt lines are collected.
properties:
collect:
description: |-
collect contains configuration options that apply only when the interrupts collector is actively collecting metrics
(i.e. when collectionPolicy is Collect).
collect is optional and may be omitted even when collectionPolicy is Collect.
collect may only be set when collectionPolicy is Collect.
When set, at least one field must be specified within collect.
minProperties: 1
properties:
include:
description: |-
include is a list of regular expression patterns that select which interrupt lines to collect.
include is optional.
Each line in /proc/interrupts is matched against the same string node-exporter uses:
the IRQ name, info, and devices fields joined with ";", for example "LOC;77;IO-APIC 2-edge ...".
Patterns are combined with OR into a single expression anchored on both ends,
so each pattern must match the entire string (use ".*" where needed).
An empty list or omitting include collects all interrupt lines.
Each entry must be at least 1 character and at most 1024 characters.
Maximum length for this list is 50.
Minimum length for this list is 1.
Entries in this list must be unique.
items:
description: |-
NodeExporterInterruptsIncludePattern is a string that is interpreted as a Go regular expression
pattern by the controller to match interrupt line names.
Invalid regular expressions will cause a controller-level error at runtime.
Must be at least 1 character and at most 1024 characters.
maxLength: 1024
minLength: 1
type: string
maxItems: 50
minItems: 1
type: array
x-kubernetes-list-type: set
type: object
collectionPolicy:
description: |-
collectionPolicy declares whether the interrupts collector collects metrics.
This field is required.
Valid values are "Collect" and "DoNotCollect".
When set to "Collect", the interrupts collector is active and interrupt statistics are collected.
When set to "DoNotCollect", the interrupts collector is inactive and the collect field must not be set.
enum:
- Collect
- DoNotCollect
type: string
required:
- collectionPolicy
type: object
x-kubernetes-validations:
- message: collect is forbidden when collectionPolicy is not
Collect
rule: 'has(self.collectionPolicy) && self.collectionPolicy
== ''Collect'' ? true : !has(self.collect)'
ksmd:
description: |-
ksmd configures the ksmd collector, which collects statistics from the kernel same-page
Expand Down
39 changes: 39 additions & 0 deletions config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,72 @@ spec:
required:
- collectionPolicy
type: object
interrupts:
description: |-
interrupts configures the interrupts collector, which exposes interrupt counts
from /proc/interrupts.
interrupts is optional.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time. The current default is disabled.
The interrupts collector can produce a large number of metrics depending on the hardware
and interrupt sources present. When enabled, use the collect.include list to filter
which interrupt lines are collected.
properties:
collect:
description: |-
collect contains configuration options that apply only when the interrupts collector is actively collecting metrics
(i.e. when collectionPolicy is Collect).
collect is optional and may be omitted even when collectionPolicy is Collect.
collect may only be set when collectionPolicy is Collect.
When set, at least one field must be specified within collect.
minProperties: 1
properties:
include:
description: |-
include is a list of regular expression patterns that select which interrupt lines to collect.
include is optional.
Each line in /proc/interrupts is matched against the same string node-exporter uses:
the IRQ name, info, and devices fields joined with ";", for example "LOC;77;IO-APIC 2-edge ...".
Patterns are combined with OR into a single expression anchored on both ends,
so each pattern must match the entire string (use ".*" where needed).
An empty list or omitting include collects all interrupt lines.
Each entry must be at least 1 character and at most 1024 characters.
Maximum length for this list is 50.
Minimum length for this list is 1.
Entries in this list must be unique.
items:
description: |-
NodeExporterInterruptsIncludePattern is a string that is interpreted as a Go regular expression
pattern by the controller to match interrupt line names.
Invalid regular expressions will cause a controller-level error at runtime.
Must be at least 1 character and at most 1024 characters.
maxLength: 1024
minLength: 1
type: string
maxItems: 50
minItems: 1
type: array
x-kubernetes-list-type: set
type: object
collectionPolicy:
description: |-
collectionPolicy declares whether the interrupts collector collects metrics.
This field is required.
Valid values are "Collect" and "DoNotCollect".
When set to "Collect", the interrupts collector is active and interrupt statistics are collected.
When set to "DoNotCollect", the interrupts collector is inactive and the collect field must not be set.
enum:
- Collect
- DoNotCollect
type: string
required:
- collectionPolicy
type: object
x-kubernetes-validations:
- message: collect is forbidden when collectionPolicy is not
Collect
rule: 'has(self.collectionPolicy) && self.collectionPolicy
== ''Collect'' ? true : !has(self.collect)'
ksmd:
description: |-
ksmd configures the ksmd collector, which collects statistics from the kernel same-page
Expand Down
10 changes: 10 additions & 0 deletions config/v1alpha1/zz_generated.model_name.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading