-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compression for Jaeger and Zipkin to autoconfigure
- Loading branch information
1 parent
abdf21e
commit ee5beec
Showing
4 changed files
with
361 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
.../testFullConfig/java/io/opentelemetry/sdk/autoconfigure/LogExporterConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.autoconfigure; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.opentelemetry.api.metrics.MeterProvider; | ||
import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogExporter; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; | ||
import io.opentelemetry.sdk.logs.export.LogExporter; | ||
import java.util.Collections; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class LogExporterConfigurationTest { | ||
|
||
@Test | ||
void configureOtlpLogsUnsupportedProtocol() { | ||
assertThatThrownBy( | ||
() -> | ||
LogExporterConfiguration.configureOtlpLogs( | ||
DefaultConfigProperties.createForTest( | ||
ImmutableMap.of("otel.exporter.otlp.protocol", "foo")), | ||
MeterProvider.noop())) | ||
.isInstanceOf(ConfigurationException.class) | ||
.hasMessageContaining("Unsupported OTLP logs protocol: foo"); | ||
} | ||
|
||
@Test | ||
void configureOtlpLogsCompressionNone() { | ||
LogExporter exporter = | ||
LogExporterConfiguration.configureOtlpLogs( | ||
DefaultConfigProperties.createForTest( | ||
Collections.singletonMap("otel.exporter.otlp.logs.compression", "none")), | ||
MeterProvider.noop()); | ||
try { | ||
assertThat(exporter) | ||
.isInstanceOfSatisfying( | ||
OtlpGrpcLogExporter.class, | ||
otlp -> assertThat(otlp).extracting("delegate.compressionEnabled").isEqualTo(false)); | ||
} finally { | ||
exporter.shutdown(); | ||
} | ||
} | ||
|
||
@Test | ||
void configureOtlpLogsCompressionGzip() { | ||
LogExporter exporter = | ||
LogExporterConfiguration.configureOtlpLogs( | ||
DefaultConfigProperties.createForTest( | ||
Collections.singletonMap("otel.exporter.otlp.logs.compression", "gzip")), | ||
MeterProvider.noop()); | ||
try { | ||
assertThat(exporter) | ||
.isInstanceOfSatisfying( | ||
OtlpGrpcLogExporter.class, | ||
otlp -> assertThat(otlp).extracting("delegate.compressionEnabled").isEqualTo(true)); | ||
} finally { | ||
exporter.shutdown(); | ||
} | ||
} | ||
|
||
@Test | ||
void configureOtlpGlobalCompressionNone() { | ||
LogExporter exporter = | ||
LogExporterConfiguration.configureOtlpLogs( | ||
DefaultConfigProperties.createForTest( | ||
Collections.singletonMap("otel.exporter.otlp.compression", "none")), | ||
MeterProvider.noop()); | ||
try { | ||
assertThat(exporter) | ||
.isInstanceOfSatisfying( | ||
OtlpGrpcLogExporter.class, | ||
otlp -> assertThat(otlp).extracting("delegate.compressionEnabled").isEqualTo(false)); | ||
} finally { | ||
exporter.shutdown(); | ||
} | ||
} | ||
|
||
@Test | ||
void configureOtlpGlobalCompressionGzip() { | ||
LogExporter exporter = | ||
LogExporterConfiguration.configureOtlpLogs( | ||
DefaultConfigProperties.createForTest( | ||
Collections.singletonMap("otel.exporter.otlp.compression", "gzip")), | ||
MeterProvider.noop()); | ||
try { | ||
assertThat(exporter) | ||
.isInstanceOfSatisfying( | ||
OtlpGrpcLogExporter.class, | ||
otlp -> assertThat(otlp).extracting("delegate.compressionEnabled").isEqualTo(true)); | ||
} finally { | ||
exporter.shutdown(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.