Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/prometheusremotewrite] disallow setting compression type other than snappy #38371

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

avanish-vaghela
Copy link
Contributor

The Prometheus Remote Write exporter only supports snappy compression type as it's required by the remote write protocol.

Description

This PR prevents users from accidentally setting the compression type other than snappy and notifying them.

Link to tracking issue

Fixes #37232

Testing

  • Unit test added

Documentation

  • Documentation updated.

@avanish-vaghela avanish-vaghela marked this pull request as draft March 5, 2025 11:03
@avanish-vaghela avanish-vaghela marked this pull request as ready for review March 5, 2025 14:48
Copy link
Contributor

@jmichalek132 jmichalek132 left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Just some very small comments and LGTM, thanks for tackling this :)

# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This change ensures that, only snappy compression type can be set as it's required by the Prometheus Remote Write protocol.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This change ensures that, only snappy compression type can be set as it's required by the Prometheus Remote Write protocol.
This change ensures that only the snappy compression type can be set, as required by the Prometheus Remote Write protocol.

@@ -124,5 +124,9 @@ func (cfg *Config) Validate() error {
cfg.MaxBatchSizeBytes = 3000000
}

if len(cfg.ClientConfig.Compression) > 0 && cfg.ClientConfig.Compression != "snappy" {
Copy link
Member

Choose a reason for hiding this comment

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

CompressionType is a string[1], there's no need to check for length :)

Suggested change
if len(cfg.ClientConfig.Compression) > 0 && cfg.ClientConfig.Compression != "snappy" {
if cfg.ClientConfig.Compression != "snappy" {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[exporter/prometheusremotewrite] Disallow configuring compression since snappy is required
5 participants