Skip to content

Support for configurable gzip compression_level in elasticsearchexporter #40501

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

Closed
JhonMartins99 opened this issue Jun 5, 2025 · 8 comments
Closed
Labels

Comments

@JhonMartins99
Copy link

Component(s)

cmd/otelcontribcol

Is your feature request related to a problem? Please describe.

Feature Request

I’m using the elasticsearchexporter in OpenTelemetry Collector version 0.117.0 and would like to configure the gzip compression level used when sending data to Elasticsearch.

Currently, the exporter supports enabling gzip compression via compression: gzip, but does not expose a compression_level option in the YAML configuration.

Since the exporter uses confighttp, and confighttp supports compression_level, it would be great to expose this setting in the exporter configuration.

Use Case

I want to optimize bandwidth usage by increasing the compression level to 9 (gzip.BestCompression), even if it means slightly higher CPU usage.

Describe the solution you'd like

Proposed Solution

Add support for a compression_level field in the exporter configuration, similar to other exporters that use confighttp.

Thanks!

Describe alternatives you've considered

No response

Additional context

No response

@JhonMartins99 JhonMartins99 added enhancement New feature or request needs triage New item requiring triage labels Jun 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

Pinging code owners for exporter/elasticsearch: @JaredTan95 @carsonip @lahsivjar. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

@VihasMakwana
Copy link
Contributor

Since the exporter uses confighttp, and confighttp supports compression_level, it would be great to expose this setting in the exporter configuration.

That setting should be exposed already. See exporter settingscom/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter#http-settings and detailed configurations for http clients

@VihasMakwana VihasMakwana added waiting for author and removed needs triage New item requiring triage labels Jun 5, 2025
@JhonMartins99
Copy link
Author

Since the exporter uses confighttp, and confighttp supports compression_level, it would be great to expose this setting in the exporter configuration.

That setting should be exposed already. See exporter settingscom/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter#http-settings and detailed configurations for http clients

Indeed, the functionality appears in the documentation, but after testing with a collector-contrib V0.117.0, unfortunately it doesn't work because it doesn't recognise this setting:
failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s): 2025-06-05T11:44:30.389701435+02:00 2025-06-05T11:44:30.389706702+02:00 error decoding 'exporters': error reading configuration for "elasticsearch/ssg": decoding failed due to the following error(s): 2025-06-05T11:44:30.389715579+02:00 2025-06-05T11:44:30.389718695+02:00 '' has invalid keys: compression_level

'/label priority:p2 -waiting-for-author'

@VihasMakwana
Copy link
Contributor

@JhonMartins99 the correct config key is compression, not compression_level.

try following:

exporters:
   elasticsearch/ssg:
      compression: gzip
      ... other fields

@JhonMartins99
Copy link
Author

JhonMartins99 commented Jun 5, 2025

@VihasMakwana in documentation booth are needed for select level of compression:
gzip
BestSpeed: 1
BestCompression: 9
DefaultCompression: -1

I used both because i need better compression (9) than default compression (1)

I test this config:

exporters:
  elasticsearch/ssg:
    endpoints:
      - https://my-endpoint:9200
    logs_index: myIndex-log
    user: xxxxx
    password: xxxxx
    timeout: 50s
    tls:
      insecure: false
      insecure_skip_verify: true
    sending_queue:
      enabled: true
      num_consumers: 15
      queue_size: 5000
    compression: gzip
    compression_level: 9

@JhonMartins99
Copy link
Author

Image

@VihasMakwana
Copy link
Contributor

VihasMakwana commented Jun 5, 2025

Oh ok. As you're on 0.117.0, the compression level wasn't supported back then. Take a look at compression settings for that verion.

You might wanna update to latest collector version and try out following:

exporters:
  elasticsearch/ssg:
    endpoints:
      - https://my-endpoint:9200
    logs_index: myIndex-log
    user: xxxxx
    password: xxxxx
    timeout: 50s
    tls:
      insecure: false
      insecure_skip_verify: true
    sending_queue:
      enabled: true
      num_consumers: 15
      queue_size: 5000
    compression: gzip
    compression_params:
       level: 9

@JhonMartins99
Copy link
Author

@VihasMakwana thankyou very match!! I test it on a 0.118.0 version and it works. ;)

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

No branches or pull requests

2 participants