Skip to content

Commit 0d329c8

Browse files
authored
feat: Support configuring compression for OTEL (#70)
* feat: Support configuring compression for OTEL * changelog * fix docs
1 parent ff4f5a2 commit 0d329c8

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Support configuring compression for OTEL ([#70]).
10+
11+
[#70]: https://github.com/stackabletech/trino-lb/pull/70
12+
713
## [0.4.1] - 2025-03-03
814

915
### Fixed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ number_prefix = "0.4"
4343
opentelemetry = "0.24"
4444
opentelemetry_sdk = { version = "0.24", features = ["rt-tokio"] }
4545
opentelemetry-http = "0.13"
46-
opentelemetry-otlp = { version = "0.17", features = ["serialize"] }
46+
opentelemetry-otlp = { version = "0.17", features = ["serialize", "gzip-tonic"] }
4747
opentelemetry-prometheus = "0.17"
4848
prometheus = "0.13"
4949
prusto = "0.5"

deploy/helm/trino-lb/configs/trino-lb-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ trinoLb:
1515
refreshQueryCounterInterval: 30s # It is low for testing purpose and to get frequent running queries metrics
1616
tracing:
1717
enabled: true
18-
# helm install jaeger jaegertracing/jaeger --set 'collector.service.otlp.grpc.name=otlp-grpc,collector.service.otlp.grpc.port=4317,collector.service.otlp.http.name=otlp-http,collector.service.otlp.http.port=4318'
18+
# helm install jaeger jaegertracing/jaeger --set 'collector.service.otlp.grpc.name=otlp-grpc,collector.service.otlp.grpc.port=4317,collector.service.otlp.http.name=otlp-http,collector.service.otlp.http.port=4318,collector.cmdlineParams.collector\.grpc-server\.max-message-size=419430400'
1919
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger-collector.default.svc.cluster.local:4317
2020
OTEL_EXPORTER_OTLP_PROTOCOL: Grpc
21+
OTEL_EXPORTER_OTLP_COMPRESSION: Gzip # TODO: This might be renamed to gzip
2122
# In case endpoint and protocol are not set here, they will still be read from the env vars
2223
# OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL
2324

trino-lb-core/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ pub struct TrinoLbTracingConfig {
9393

9494
#[serde(rename = "OTEL_EXPORTER_OTLP_PROTOCOL")]
9595
pub otlp_protocol: Option<opentelemetry_otlp::Protocol>,
96+
97+
/// TODO: Ideally [`opentelemetry_otlp::Compression`] would serialize and deserialize to
98+
/// `gzip`. However, they currently de/ser to `Gzip`, which differs from `opentelemetry_otlp::Compression::from_str`
99+
/// We should raise an upstream issue
100+
#[serde(rename = "OTEL_EXPORTER_OTLP_COMPRESSION")]
101+
pub otlp_compression: Option<opentelemetry_otlp::Compression>,
96102
}
97103

98104
#[derive(Clone, Debug, Deserialize)]

trino-lb/src/tracing.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ fn exporter(tracing_config: &TrinoLbTracingConfig) -> TonicExporterBuilder {
138138
if let Some(protocol) = tracing_config.otlp_protocol {
139139
exporter = exporter.with_protocol(protocol);
140140
}
141+
if let Some(compression) = tracing_config.otlp_compression {
142+
exporter = exporter.with_compression(compression);
143+
}
141144

142145
// In case endpoint and protocol are not set here, they will still be read from the env vars
143146
// OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL

0 commit comments

Comments
 (0)