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

Move autoconfigure otlp tests #5060

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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