Skip to content

Commit

Permalink
Move autoconfigure otlp tests (#5060)
Browse files Browse the repository at this point in the history
* Unify OtlpHttp{Signal}Exporter testing

* Add header and compression tests

* Move SPI otlp tests to :exporters:otlp

* Improve test coverage

* Improve test coverage
  • Loading branch information
jack-berg authored Dec 29, 2022
1 parent 50b6b3f commit 2834b03
Show file tree
Hide file tree
Showing 34 changed files with 1,914 additions and 2,847 deletions.
2 changes: 2 additions & 0 deletions exporters/otlp/all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ dependencies {

compileOnly("io.grpc:grpc-stub")

testImplementation("io.grpc:grpc-stub")

testImplementation(project(":exporters:otlp:testing-internal"))
testImplementation("com.linecorp.armeria:armeria-junit5")
testImplementation("com.google.api.grpc:proto-google-common-protos")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public MetricExporter createExporter(ConfigProperties config) {
String protocol = OtlpConfigUtil.getOtlpProtocol(DATA_TYPE_METRICS, config);

if (protocol.equals(PROTOCOL_HTTP_PROTOBUF)) {
OtlpHttpMetricExporterBuilder builder = OtlpHttpMetricExporter.builder();
OtlpHttpMetricExporterBuilder builder = httpBuilder();

OtlpConfigUtil.configureOtlpExporterBuilder(
DATA_TYPE_METRICS,
Expand All @@ -52,7 +52,7 @@ public MetricExporter createExporter(ConfigProperties config) {

return builder.build();
} else if (protocol.equals(PROTOCOL_GRPC)) {
OtlpGrpcMetricExporterBuilder builder = OtlpGrpcMetricExporter.builder();
OtlpGrpcMetricExporterBuilder builder = grpcBuilder();

OtlpConfigUtil.configureOtlpExporterBuilder(
DATA_TYPE_METRICS,
Expand All @@ -78,4 +78,14 @@ public MetricExporter createExporter(ConfigProperties config) {
public String getName() {
return "otlp";
}

// Visible for testing
OtlpHttpMetricExporterBuilder httpBuilder() {
return OtlpHttpMetricExporter.builder();
}

// Visible for testing
OtlpGrpcMetricExporterBuilder grpcBuilder() {
return OtlpGrpcMetricExporter.builder();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class OtlpSpanExporterProvider implements ConfigurableSpanExporterProvide
public SpanExporter createExporter(ConfigProperties config) {
String protocol = OtlpConfigUtil.getOtlpProtocol(DATA_TYPE_TRACES, config);
if (protocol.equals(PROTOCOL_HTTP_PROTOBUF)) {
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder();
OtlpHttpSpanExporterBuilder builder = httpBuilder();

OtlpConfigUtil.configureOtlpExporterBuilder(
DATA_TYPE_TRACES,
Expand All @@ -47,7 +47,7 @@ public SpanExporter createExporter(ConfigProperties config) {

return builder.build();
} else if (protocol.equals(PROTOCOL_GRPC)) {
OtlpGrpcSpanExporterBuilder builder = OtlpGrpcSpanExporter.builder();
OtlpGrpcSpanExporterBuilder builder = grpcBuilder();

OtlpConfigUtil.configureOtlpExporterBuilder(
DATA_TYPE_TRACES,
Expand All @@ -69,4 +69,14 @@ public SpanExporter createExporter(ConfigProperties config) {
public String getName() {
return "otlp";
}

// Visible for testing
OtlpHttpSpanExporterBuilder httpBuilder() {
return OtlpHttpSpanExporter.builder();
}

// Visible for testing
OtlpGrpcSpanExporterBuilder grpcBuilder() {
return OtlpGrpcSpanExporter.builder();
}
}
Loading

0 comments on commit 2834b03

Please sign in to comment.