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
17 changes: 17 additions & 0 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,12 @@ type RemoteWriteSpec struct {
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:XValidation:rule="self.matches('^[a-zA-Z0-9_-]+$')",message="must contain only alphanumeric characters, hyphens, and underscores"
Name string `json:"name,omitempty"`
// messageVersion defines the Remote Write message's version to use when writing to the endpoint.
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.

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.

What is the current default behavior?

// When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
// When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
Comment on lines +1555 to +1556

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.

Based on the enum constraints, "Version1.0" and "Version2.0" would be rejected inputs. Either align this text with the actual allowed inputs or update the allowed inputs to match these documented strings.

// +optional
MessageVersion RemoteWriteMessageVersion `json:"messageVersion,omitempty,omitzero"`
// authorization defines the authorization method for the remote write endpoint.
// When omitted, no authorization is performed.
// When set, type must be one of Authorization, BasicAuth, OAuth2, SigV4, or ServiceAccount; the corresponding nested config must be set (ServiceAccount has no config).
Expand Down Expand Up @@ -1747,6 +1753,17 @@ type RemoteWriteAuthorization struct {
// SafeAuthorization *v1.SecretKeySelector `json:"safeAuthorization,omitempty"`
}

// RemoteWriteMessageVersion defines the version of the remote-write protocol.
// +kubebuilder:validation:Enum=V1.0;V2.0
type RemoteWriteMessageVersion string

const (
// RemoteWriteMessageVersion1_0 indicates the version 1.0 of the remote-write protocol.
RemoteWriteMessageVersion1_0 RemoteWriteMessageVersion = "V1.0"
// RemoteWriteMessageVersion2_0 indicates the version 2.0 of the remote-write protocol.
RemoteWriteMessageVersion2_0 RemoteWriteMessageVersion = "V2.0"
)

// MetadataConfigSendPolicy defines whether to send metadata with platform defaults or with custom settings.
// +kubebuilder:validation:Enum=Default;Custom
type MetadataConfigSendPolicy string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3849,6 +3849,16 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
messageVersion:
description: |-
messageVersion defines the Remote Write message's version to use when writing to the endpoint.
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
enum:
- V1.0
- V2.0
type: string
metadataConfig:
description: |-
metadataConfig configures the sending of series metadata to remote storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3849,6 +3849,16 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
messageVersion:
description: |-
messageVersion defines the Remote Write message's version to use when writing to the endpoint.
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
enum:
- V1.0
- V2.0
type: string
metadataConfig:
description: |-
metadataConfig configures the sending of series metadata to remote storage.
Expand Down
1 change: 1 addition & 0 deletions config/v1alpha1/zz_generated.swagger_doc_generated.go

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

8 changes: 8 additions & 0 deletions openapi/generated_openapi/zz_generated.openapi.go

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

5 changes: 5 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14767,6 +14767,11 @@
],
"x-kubernetes-list-type": "map"
},
"messageVersion": {
"description": "messageVersion defines the Remote Write message's version to use when writing to the endpoint. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. When set to \"Version1.0\", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0. When set to \"Version2.0\", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.",
"type": "string",
"default": ""
},
"metadataConfig": {
"description": "metadataConfig configures the sending of series metadata to remote storage. When omitted, no metadata is sent. When set to sendPolicy: Default, metadata is sent using platform-chosen defaults (e.g. send interval 30 seconds). When set to sendPolicy: Custom, metadata is sent using the settings in the custom field (e.g. custom.sendIntervalSeconds).",
"default": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3849,6 +3849,16 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
messageVersion:
description: |-
messageVersion defines the Remote Write message's version to use when writing to the endpoint.
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
enum:
- V1.0
- V2.0
Comment on lines +3856 to +3860

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

Document the enum values accepted by the schema

The descriptions say to use Version1.0 and Version2.0, but the enum only accepts V1.0 and V2.0. Users following this documentation will submit rejected resources.

Proposed fix
-                            When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
-                            When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
+                            When set to "V1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
+                            When set to "V2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
When set to "Version1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
When set to "Version2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
enum:
- V1.0
- V2.0
When set to "V1.0", Prometheus uses the `prometheus.WriteRequest` protobuf message introduced in Remote Write 1.0.
When set to "V2.0", Prometheus uses the `io.prometheus.write.v2.Request` protobuf message introduced in Remote Write 2.0.
enum:
- V1.0
- V2.0
🤖 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
`@payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml`
around lines 3856 - 3860, Update the remote write protobuf version schema
description to document the accepted enum values V1.0 and V2.0, matching the
enum entries under this field; do not instruct users to submit Version1.0 or
Version2.0.

type: string
metadataConfig:
description: |-
metadataConfig configures the sending of series metadata to remote storage.
Expand Down