From 92bd65970eb22a860151f66a96b66e02dc416fcf Mon Sep 17 00:00:00 2001 From: jack-berg <34418638+jack-berg@users.noreply.github.com> Date: Fri, 27 May 2022 21:23:41 -0500 Subject: [PATCH] Merge otlp exporters (#4499) * Merge otlp http trace and metric exporters into :exporters:otlp:all * Merge otlp http exporter into :exporters:otlp:logs * Artifact descriptions --- README.md | 27 ++++++------ .../opentelemetry-exporter-otlp.txt | 41 +++++++++++++++++++ exporters/otlp-http/build.gradle.kts | 10 ----- exporters/otlp-http/logs/build.gradle.kts | 24 ----------- exporters/otlp-http/logs/gradle.properties | 1 - exporters/otlp-http/metrics/README.md | 8 ---- exporters/otlp-http/metrics/build.gradle.kts | 24 ----------- exporters/otlp-http/trace/README.md | 8 ---- exporters/otlp-http/trace/build.gradle.kts | 24 ----------- exporters/otlp/all/build.gradle.kts | 5 ++- .../http/metrics/OtlpHttpMetricExporter.java | 0 .../OtlpHttpMetricExporterBuilder.java | 0 .../otlp/http/metrics/package-info.java | 0 .../otlp/http/trace/OtlpHttpSpanExporter.java | 0 .../trace/OtlpHttpSpanExporterBuilder.java | 0 .../otlp/http/trace/package-info.java | 0 .../metrics/OtlpHttpMetricExporterTest.java | 0 .../http/trace/OtlpHttpSpanExporterTest.java | 0 exporters/otlp/logs/build.gradle.kts | 6 ++- .../otlp/http/logs/OtlpHttpLogExporter.java | 0 .../http/logs/OtlpHttpLogExporterBuilder.java | 0 .../exporter/otlp/http/logs/package-info.java | 0 .../http/logs/OtlpHttpLogExporterTest.java | 0 integration-tests/otlp/build.gradle.kts | 3 -- sdk-extensions/autoconfigure/build.gradle.kts | 20 +-------- .../sdk/autoconfigure/OtlpGrpcConfigTest.java | 28 +++++++++++++ .../sdk/autoconfigure/OtlpGrpcRetryTest.java | 0 .../OtlpGrpcServerExtension.java | 0 .../sdk/autoconfigure/OtlpHttpConfigTest.java | 2 + .../sdk/autoconfigure/OtlpHttpRetryTest.java | 0 .../OtlpHttpServerExtension.java | 0 settings.gradle.kts | 3 -- 32 files changed, 94 insertions(+), 140 deletions(-) delete mode 100644 exporters/otlp-http/build.gradle.kts delete mode 100644 exporters/otlp-http/logs/build.gradle.kts delete mode 100644 exporters/otlp-http/logs/gradle.properties delete mode 100644 exporters/otlp-http/metrics/README.md delete mode 100644 exporters/otlp-http/metrics/build.gradle.kts delete mode 100644 exporters/otlp-http/trace/README.md delete mode 100644 exporters/otlp-http/trace/build.gradle.kts rename exporters/{otlp-http/metrics => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporter.java (100%) rename exporters/{otlp-http/metrics => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterBuilder.java (100%) rename exporters/{otlp-http/metrics => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/package-info.java (100%) rename exporters/{otlp-http/trace => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporter.java (100%) rename exporters/{otlp-http/trace => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java (100%) rename exporters/{otlp-http/trace => otlp/all}/src/main/java/io/opentelemetry/exporter/otlp/http/trace/package-info.java (100%) rename exporters/{otlp-http/metrics => otlp/all}/src/test/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterTest.java (100%) rename exporters/{otlp-http/trace => otlp/all}/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java (100%) rename exporters/{otlp-http => otlp}/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporter.java (100%) rename exporters/{otlp-http => otlp}/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterBuilder.java (100%) rename exporters/{otlp-http => otlp}/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/package-info.java (100%) rename exporters/{otlp-http => otlp}/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java (100%) rename sdk-extensions/autoconfigure/src/{testOtlpGrpc => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java (92%) rename sdk-extensions/autoconfigure/src/{testOtlpGrpc => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcRetryTest.java (100%) rename sdk-extensions/autoconfigure/src/{testOtlpGrpc => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcServerExtension.java (100%) rename sdk-extensions/autoconfigure/src/{testOtlpHttp => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java (99%) rename sdk-extensions/autoconfigure/src/{testOtlpHttp => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpRetryTest.java (100%) rename sdk-extensions/autoconfigure/src/{testOtlpHttp => testOtlp}/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpServerExtension.java (100%) diff --git a/README.md b/README.md index ac7a940defd..800b5445b59 100644 --- a/README.md +++ b/README.md @@ -248,21 +248,18 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti ### SDK Exporters -| Component | Description | Artifact ID | Version | -|-------------------------------------------------------------|-------------------------------------------------------------------------------------|--------------------------------------------|-------------------------------------------------------------| -| [OTLP gRPC Exporter](./exporters/otlp/all) | OTLP gRPC exporters, including metrics and trace | `opentelemetry-exporter-otlp` | 1.14.0 | -| [OTLP gRPC Logs Exporter](./exporters/otlp/logs) | OTLP gRPC log exporter | `opentelemetry-exporter-otlp-logs` | 1.14.0-alpha | -| [OTLP HTTP Trace Exporter](./exporters/otlp-http/trace) | OTLP http/protobuf trace exporter | `opentelemetry-exporter-otlp-http-trace` | 1.14.0 | -| [OTLP HTTP Metrics Exporter](./exporters/otlp-http/metrics) | OTLP http/protobuf metrics exporter | `opentelemetry-exporter-otlp-http-metrics` | 1.14.0 | -| [OTLP HTTP Logs Exporter](./exporters/otlp-http/logs) | OTLP http/protobuf logs exporter | `opentelemetry-exporter-otlp-http-logs` | 1.14.0-alpha | -| [OTLP Common](./exporters/otlp/common) | Shared OTLP components (internal) | `opentelemetry-exporter-otlp-common` | 1.14.0 | -| [Jaeger gRPC Exporter](./exporters/jaeger) | Jaeger gRPC trace exporter | `opentelemetry-exporter-jaeger` | 1.14.0 | -| [Jaeger Thrift Exporter](./exporters/jaeger-thrift) | Jaeger thrift trace exporter | `opentelemetry-exporter-jaeger-thift` | 1.14.0 | -| [Jaeger Proto](./exporters/jaeger-proto) | Jaeger gRPC protobuf definitions (deprecated) | `opentelemetry-exporter-jaeger-proto` | 1.14.0 | -| [Logging Exporter](./exporters/logging) | Logging exporters, includings metrics, traces, and logs | `opentelemetry-exporter-logging` | 1.14.0 | -| [OTLP Logging Exporter](./exporters/logging-otlp) | Logging exporters in OTLP protobuf JSON format, including metrics, traces, and logs | `opentelemetry-exporter-logging-otlp` | 1.14.0 | -| [Zipkin Exporter](./exporters/zipkin) | Zipkin trace exporter | `opentelemetry-exporter-zipkin` | 1.14.0 | -| [Prometheus Exporter](./exporters/prometheus) | Prometheus metric exporter | `opentelemetry-exporter-prometheus` | 1.14.0-alpha | +| Component | Description | Artifact ID | Version | +|-----------------------------------------------------|-------------------------------------------------------------------------------------|---------------------------------------|-------------------------------------------------------------| +| [OTLP Exporters](./exporters/otlp/all) | OTLP gRPC & HTTP exporters, including metrics and trace | `opentelemetry-exporter-otlp` | 1.14.0 | +| [OTLP Log Exporters](./exporters/otlp/logs) | OTLP gRPC & HTTP log exporters | `opentelemetry-exporter-otlp-logs` | 1.14.0-alpha | +| [OTLP Common](./exporters/otlp/common) | Shared OTLP components (internal) | `opentelemetry-exporter-otlp-common` | 1.14.0 | +| [Jaeger gRPC Exporter](./exporters/jaeger) | Jaeger gRPC trace exporter | `opentelemetry-exporter-jaeger` | 1.14.0 | +| [Jaeger Thrift Exporter](./exporters/jaeger-thrift) | Jaeger thrift trace exporter | `opentelemetry-exporter-jaeger-thift` | 1.14.0 | +| [Jaeger Proto](./exporters/jaeger-proto) | Jaeger gRPC protobuf definitions (deprecated) | `opentelemetry-exporter-jaeger-proto` | 1.14.0 | +| [Logging Exporter](./exporters/logging) | Logging exporters, includings metrics, traces, and logs | `opentelemetry-exporter-logging` | 1.14.0 | +| [OTLP Logging Exporter](./exporters/logging-otlp) | Logging exporters in OTLP protobuf JSON format, including metrics, traces, and logs | `opentelemetry-exporter-logging-otlp` | 1.14.0 | +| [Zipkin Exporter](./exporters/zipkin) | Zipkin trace exporter | `opentelemetry-exporter-zipkin` | 1.14.0 | +| [Prometheus Exporter](./exporters/prometheus) | Prometheus metric exporter | `opentelemetry-exporter-prometheus` | 1.14.0-alpha | ### SDK Extensions diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-exporter-otlp.txt b/docs/apidiffs/current_vs_latest/opentelemetry-exporter-otlp.txt index 7f27b6986f7..a376f0e41e4 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-exporter-otlp.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-exporter-otlp.txt @@ -1,4 +1,45 @@ Comparing source compatibility of against ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder builder() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode export(java.util.Collection) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode flush() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality(io.opentelemetry.sdk.metrics.InstrumentType) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter getDefault() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder addHeader(java.lang.String, java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter build() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setAggregationTemporalitySelector(io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setClientTls(byte[], byte[]) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setCompression(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setEndpoint(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setTimeout(long, java.util.concurrent.TimeUnit) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setTimeout(java.time.Duration) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setTrustedCertificates(byte[]) ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder builder() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode export(java.util.Collection) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode flush() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter getDefault() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder addHeader(java.lang.String, java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter build() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setClientTls(byte[], byte[]) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setCompression(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setEndpoint(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setMeterProvider(io.opentelemetry.api.metrics.MeterProvider) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setTimeout(long, java.util.concurrent.TimeUnit) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setTimeout(java.time.Duration) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setTrustedCertificates(byte[]) +++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter (not serializable) +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. +++ NEW SUPERCLASS: java.lang.Object diff --git a/exporters/otlp-http/build.gradle.kts b/exporters/otlp-http/build.gradle.kts deleted file mode 100644 index a75b7e9c182..00000000000 --- a/exporters/otlp-http/build.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -subprojects { - // Workaround https://github.com/gradle/gradle/issues/847 - group = "io.opentelemetry.exporter.otlp.http" - val proj = this - plugins.withId("java") { - configure { - archivesName.set("opentelemetry-exporter-otlp-http-${proj.name}") - } - } -} diff --git a/exporters/otlp-http/logs/build.gradle.kts b/exporters/otlp-http/logs/build.gradle.kts deleted file mode 100644 index 7be794f7773..00000000000 --- a/exporters/otlp-http/logs/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id("otel.java-conventions") - id("otel.publish-conventions") - - id("otel.animalsniffer-conventions") -} - -description = "OpenTelemetry Protocol HTTP Logs Exporter" -otelJava.moduleName.set("io.opentelemetry.exporter.otlp.http.logs") - -dependencies { - api(project(":sdk:logs")) - - implementation(project(":exporters:otlp:common")) - - implementation("com.squareup.okhttp3:okhttp") - - testImplementation(project(":sdk:testing")) - - testImplementation("com.google.api.grpc:proto-google-common-protos") - testImplementation("com.linecorp.armeria:armeria-junit5") - testImplementation("com.squareup.okhttp3:okhttp-tls") - testImplementation("io.opentelemetry.proto:opentelemetry-proto") -} diff --git a/exporters/otlp-http/logs/gradle.properties b/exporters/otlp-http/logs/gradle.properties deleted file mode 100644 index 4476ae57e31..00000000000 --- a/exporters/otlp-http/logs/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -otel.release=alpha diff --git a/exporters/otlp-http/metrics/README.md b/exporters/otlp-http/metrics/README.md deleted file mode 100644 index b15e95db526..00000000000 --- a/exporters/otlp-http/metrics/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# OpenTelemetry - OTLP Metrics Exporter - HTTP - -[![Javadocs][javadoc-image]][javadoc-url] - -This is the OpenTelemetry exporter, sending metric data to OpenTelemetry collector via HTTP without gRPC. - -[javadoc-image]: https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-exporter-otlp-http-metrics.svg -[javadoc-url]: https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp-http-metrics diff --git a/exporters/otlp-http/metrics/build.gradle.kts b/exporters/otlp-http/metrics/build.gradle.kts deleted file mode 100644 index 200f15578b0..00000000000 --- a/exporters/otlp-http/metrics/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id("otel.java-conventions") - id("otel.publish-conventions") - - id("otel.animalsniffer-conventions") -} - -description = "OpenTelemetry Protocol HTTP Metrics Exporter" -otelJava.moduleName.set("io.opentelemetry.exporter.otlp.http.metrics") - -dependencies { - api(project(":sdk:metrics")) - - implementation(project(":exporters:otlp:common")) - - implementation("com.squareup.okhttp3:okhttp") - - testImplementation(project(":sdk:testing")) - - testImplementation("com.google.api.grpc:proto-google-common-protos") - testImplementation("com.linecorp.armeria:armeria-junit5") - testImplementation("com.squareup.okhttp3:okhttp-tls") - testImplementation("io.opentelemetry.proto:opentelemetry-proto") -} diff --git a/exporters/otlp-http/trace/README.md b/exporters/otlp-http/trace/README.md deleted file mode 100644 index c7f09e2e5ed..00000000000 --- a/exporters/otlp-http/trace/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# OpenTelemetry - OTLP Trace Exporter - HTTP - -[![Javadocs][javadoc-image]][javadoc-url] - -This is the OpenTelemetry exporter, sending span data to OpenTelemetry collector via HTTP without gRPC. - -[javadoc-image]: https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-exporter-otlp-http-trace.svg -[javadoc-url]: https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp-http-trace diff --git a/exporters/otlp-http/trace/build.gradle.kts b/exporters/otlp-http/trace/build.gradle.kts deleted file mode 100644 index d8938593dee..00000000000 --- a/exporters/otlp-http/trace/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id("otel.java-conventions") - id("otel.publish-conventions") - - id("otel.animalsniffer-conventions") -} - -description = "OpenTelemetry Protocol HTTP Trace Exporter" -otelJava.moduleName.set("io.opentelemetry.exporter.otlp.http.trace") - -dependencies { - api(project(":sdk:trace")) - - implementation(project(":exporters:otlp:common")) - - implementation("com.squareup.okhttp3:okhttp") - - testImplementation(project(":sdk:testing")) - - testImplementation("com.google.api.grpc:proto-google-common-protos") - testImplementation("com.linecorp.armeria:armeria-junit5") - testImplementation("com.squareup.okhttp3:okhttp-tls") - testImplementation("io.opentelemetry.proto:opentelemetry-proto") -} diff --git a/exporters/otlp/all/build.gradle.kts b/exporters/otlp/all/build.gradle.kts index 72230f4e2b0..35fb7695015 100644 --- a/exporters/otlp/all/build.gradle.kts +++ b/exporters/otlp/all/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("otel.animalsniffer-conventions") } -description = "OpenTelemetry Protocol gRPC Exporters" +description = "OpenTelemetry Protocol (OTLP) Exporters" otelJava.moduleName.set("io.opentelemetry.exporter.otlp") base.archivesName.set("opentelemetry-exporter-otlp") @@ -19,6 +19,9 @@ dependencies { compileOnly("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") + testImplementation("com.squareup.okhttp3:okhttp-tls") jmhImplementation(project(":sdk:testing")) jmhImplementation("com.linecorp.armeria:armeria") diff --git a/exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporter.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporter.java similarity index 100% rename from exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporter.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporter.java diff --git a/exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterBuilder.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterBuilder.java similarity index 100% rename from exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterBuilder.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterBuilder.java diff --git a/exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/package-info.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/package-info.java similarity index 100% rename from exporters/otlp-http/metrics/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/package-info.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/metrics/package-info.java diff --git a/exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporter.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporter.java similarity index 100% rename from exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporter.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporter.java diff --git a/exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java similarity index 100% rename from exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java diff --git a/exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/package-info.java b/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/package-info.java similarity index 100% rename from exporters/otlp-http/trace/src/main/java/io/opentelemetry/exporter/otlp/http/trace/package-info.java rename to exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/package-info.java diff --git a/exporters/otlp-http/metrics/src/test/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterTest.java b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterTest.java similarity index 100% rename from exporters/otlp-http/metrics/src/test/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterTest.java rename to exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/metrics/OtlpHttpMetricExporterTest.java diff --git a/exporters/otlp-http/trace/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java similarity index 100% rename from exporters/otlp-http/trace/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java rename to exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java diff --git a/exporters/otlp/logs/build.gradle.kts b/exporters/otlp/logs/build.gradle.kts index 166a639bfac..5bd66a0a0f3 100644 --- a/exporters/otlp/logs/build.gradle.kts +++ b/exporters/otlp/logs/build.gradle.kts @@ -5,7 +5,7 @@ plugins { id("otel.animalsniffer-conventions") } -description = "OpenTelemetry Protocol Logs Exporter" +description = "OpenTelemetry Protocol (OTLP) Log Exporters" otelJava.moduleName.set("io.opentelemetry.exporter.otlp.logs") dependencies { @@ -16,6 +16,10 @@ dependencies { compileOnly("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") + testImplementation("com.squareup.okhttp3:okhttp-tls") } testing { diff --git a/exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporter.java b/exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporter.java similarity index 100% rename from exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporter.java rename to exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporter.java diff --git a/exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterBuilder.java b/exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterBuilder.java similarity index 100% rename from exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterBuilder.java rename to exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterBuilder.java diff --git a/exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/package-info.java b/exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/package-info.java similarity index 100% rename from exporters/otlp-http/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/package-info.java rename to exporters/otlp/logs/src/main/java/io/opentelemetry/exporter/otlp/http/logs/package-info.java diff --git a/exporters/otlp-http/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java b/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java similarity index 100% rename from exporters/otlp-http/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java rename to exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java diff --git a/integration-tests/otlp/build.gradle.kts b/integration-tests/otlp/build.gradle.kts index 3a25ae0921c..6b1dd94765e 100644 --- a/integration-tests/otlp/build.gradle.kts +++ b/integration-tests/otlp/build.gradle.kts @@ -10,9 +10,6 @@ dependencies { implementation(project(":exporters:otlp:all")) implementation(project(":exporters:otlp:logs")) - implementation(project(":exporters:otlp-http:logs")) - implementation(project(":exporters:otlp-http:metrics")) - implementation(project(":exporters:otlp-http:trace")) implementation(project(":semconv")) implementation("com.linecorp.armeria:armeria-grpc-protocol") diff --git a/sdk-extensions/autoconfigure/build.gradle.kts b/sdk-extensions/autoconfigure/build.gradle.kts index e1b51ca4705..ed74b3b83f1 100644 --- a/sdk-extensions/autoconfigure/build.gradle.kts +++ b/sdk-extensions/autoconfigure/build.gradle.kts @@ -19,9 +19,6 @@ dependencies { compileOnly(project(":exporters:otlp:all")) compileOnly(project(":exporters:otlp:logs")) compileOnly(project(":exporters:otlp:common")) - compileOnly(project(":exporters:otlp-http:trace")) - compileOnly(project(":exporters:otlp-http:metrics")) - compileOnly(project(":exporters:otlp-http:logs")) compileOnly(project(":exporters:prometheus")) compileOnly(project(":exporters:zipkin")) @@ -118,7 +115,7 @@ testing { } } } - val testOtlpGrpc by registering(JvmTestSuite::class) { + val testOtlp by registering(JvmTestSuite::class) { dependencies { implementation(project(":exporters:otlp:all")) implementation(project(":exporters:otlp:logs")) @@ -128,22 +125,9 @@ testing { implementation("io.opentelemetry.proto:opentelemetry-proto") implementation("com.linecorp.armeria:armeria-junit5") implementation("com.linecorp.armeria:armeria-grpc") - runtimeOnly("io.grpc:grpc-netty-shaded") - } - } - val testOtlpHttp by registering(JvmTestSuite::class) { - dependencies { - implementation(project(":exporters:otlp-http:trace")) - implementation(project(":exporters:otlp-http:metrics")) - implementation(project(":exporters:otlp-http:logs")) - implementation(project(":exporters:otlp:common")) - implementation(project(":sdk:testing")) - - implementation("com.google.guava:guava") - implementation("com.linecorp.armeria:armeria-junit5") implementation("com.squareup.okhttp3:okhttp") implementation("com.squareup.okhttp3:okhttp-tls") - implementation("io.opentelemetry.proto:opentelemetry-proto") + runtimeOnly("io.grpc:grpc-netty-shaded") } } val testPrometheus by registering(JvmTestSuite::class) { diff --git a/sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java similarity index 92% rename from sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java index 8be803c3ac1..00a890007a8 100644 --- a/sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java +++ b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcConfigTest.java @@ -16,6 +16,7 @@ import com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.metrics.MeterProvider; +import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.logs.data.LogData; @@ -26,6 +27,7 @@ import io.opentelemetry.sdk.metrics.export.MetricExporter; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.export.SpanExporter; +import java.lang.reflect.Field; import java.nio.file.Paths; import java.util.HashMap; import java.util.List; @@ -60,6 +62,7 @@ void setUp() { @AfterEach public void tearDown() { server.reset(); + shutdownGlobalSdk(); GlobalOpenTelemetry.resetForTest(); } @@ -324,4 +327,29 @@ void configuresGlobal() { assertThat(server.metricRequests).isNotEmpty(); }); } + + static void shutdownGlobalSdk() { + try { + Field globalOpenTelemetryField = + GlobalOpenTelemetry.class.getDeclaredField("globalOpenTelemetry"); + globalOpenTelemetryField.setAccessible(true); + Object globalOpenTelemetry = globalOpenTelemetryField.get(null); + if (globalOpenTelemetry == null) { + return; + } + Field delegateField = + Class.forName("io.opentelemetry.api.GlobalOpenTelemetry$ObfuscatedOpenTelemetry") + .getDeclaredField("delegate"); + delegateField.setAccessible(true); + Object delegate = delegateField.get(globalOpenTelemetry); + if (delegate instanceof OpenTelemetrySdk) { + OpenTelemetrySdk sdk = ((OpenTelemetrySdk) delegate); + sdk.getSdkTracerProvider().shutdown().join(10, TimeUnit.SECONDS); + sdk.getSdkMeterProvider().shutdown().join(10, TimeUnit.SECONDS); + sdk.getSdkLogEmitterProvider().shutdown().join(10, TimeUnit.SECONDS); + } + } catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException e) { + throw new IllegalStateException("Error shutting down global SDK.", e); + } + } } diff --git a/sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcRetryTest.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcRetryTest.java similarity index 100% rename from sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcRetryTest.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcRetryTest.java diff --git a/sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcServerExtension.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcServerExtension.java similarity index 100% rename from sdk-extensions/autoconfigure/src/testOtlpGrpc/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcServerExtension.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpGrpcServerExtension.java diff --git a/sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java similarity index 99% rename from sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java index b1d659a0ad1..2c1e99a2bb1 100644 --- a/sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java +++ b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpConfigTest.java @@ -5,6 +5,7 @@ package io.opentelemetry.sdk.autoconfigure; +import static io.opentelemetry.sdk.autoconfigure.OtlpGrpcConfigTest.shutdownGlobalSdk; import static io.opentelemetry.sdk.autoconfigure.OtlpHttpServerExtension.generateFakeLog; import static io.opentelemetry.sdk.autoconfigure.OtlpHttpServerExtension.generateFakeMetric; import static io.opentelemetry.sdk.autoconfigure.OtlpHttpServerExtension.generateFakeSpan; @@ -47,6 +48,7 @@ void setUp() { @AfterEach public void tearDown() { + shutdownGlobalSdk(); GlobalOpenTelemetry.resetForTest(); } diff --git a/sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpRetryTest.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpRetryTest.java similarity index 100% rename from sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpRetryTest.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpRetryTest.java diff --git a/sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpServerExtension.java b/sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpServerExtension.java similarity index 100% rename from sdk-extensions/autoconfigure/src/testOtlpHttp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpServerExtension.java rename to sdk-extensions/autoconfigure/src/testOtlp/java/io/opentelemetry/sdk/autoconfigure/OtlpHttpServerExtension.java diff --git a/settings.gradle.kts b/settings.gradle.kts index 20ee85b184e..60a641bf29e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -42,9 +42,6 @@ include(":exporters:otlp:all") include(":exporters:otlp:common") include(":exporters:otlp:logs") include(":exporters:otlp:testing-internal") -include(":exporters:otlp-http:logs") -include(":exporters:otlp-http:metrics") -include(":exporters:otlp-http:trace") include(":exporters:prometheus") include(":exporters:zipkin") include(":integration-tests")