diff --git a/.dockerignore b/.dockerignore index 08d807a..805d603 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,7 +8,6 @@ !build-bin/maven/maven_unjar # Allow on-demand "mvn package". referenced in pom.xml must be added even if not built -!collector-grpc/src/main/** !collector-http/src/main/** !module/src/main/** !**/pom.xml diff --git a/README.md b/README.md index 4b80a0d..850c0d0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ persists them to a configured collector component. | Collector | Description | |------------------------------------|-----------------------------------------------------------------------------------------| -| [collector-grpc](./collector-grpc) | Implements the [OTLP/gRPC protocol](https://opentelemetry.io/docs/specs/otlp/#otlpgrpc) | | [collector-http](./collector-http) | Implements the [OTLP/HTTP protocol](https://opentelemetry.io/docs/specs/otlp/#otlphttp) | ## Server integration diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index b6d2a32..e0a1287 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -34,11 +34,6 @@ - - ${project.groupId} - zipkin-collector-otel-grpc - ${project.version} - ${project.groupId} zipkin-collector-otel-http diff --git a/collector-grpc/README.md b/collector-grpc/README.md deleted file mode 100644 index e8b13b2..0000000 --- a/collector-grpc/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# zipkin-collector-otel-grpc - -This component implements -the [OTLP/gRPC protocol](https://opentelemetry.io/docs/specs/otlp/#otlpgrpc) -with [Armeria](https://armeria.dev/). diff --git a/collector-grpc/pom.xml b/collector-grpc/pom.xml deleted file mode 100644 index 146ca56..0000000 --- a/collector-grpc/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 4.0.0 - - - io.zipkin.contrib.otel - zipkin-otel-parent - 0.1.0-SNAPSHOT - ../pom.xml - - - zipkin-collector-otel-grpc - Zipkin Collector: OpenTelemetry gRPC - - - ${project.basedir}/.. - - - - - ${zipkin.groupId} - zipkin-collector - ${zipkin.version} - - - - ${armeria.groupId} - armeria-grpc-protocol - ${armeria.version} - - - - ${zipkin.groupId} - zipkin-tests - ${zipkin.version} - test - - - - ${armeria.groupId} - armeria-grpc - ${armeria.version} - test - - - - ${armeria.groupId} - armeria-junit5 - ${armeria.version} - test - - - diff --git a/collector-grpc/src/main/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollector.java b/collector-grpc/src/main/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollector.java deleted file mode 100644 index 17bb6f0..0000000 --- a/collector-grpc/src/main/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollector.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin2.collector.otel.grpc; - -import com.linecorp.armeria.server.ServerBuilder; -import com.linecorp.armeria.server.ServerConfigurator; -import com.linecorp.armeria.server.ServiceRequestContext; -import com.linecorp.armeria.server.grpc.protocol.AbstractUnsafeUnaryGrpcService; -import io.netty.buffer.ByteBuf; -import java.util.concurrent.CompletionStage; -import zipkin2.collector.Collector; -import zipkin2.collector.CollectorComponent; -import zipkin2.collector.CollectorMetrics; -import zipkin2.collector.CollectorSampler; -import zipkin2.storage.StorageComponent; - -public final class OpenTelemetryGrpcCollector extends CollectorComponent - implements ServerConfigurator { - public static Builder newBuilder() { - return new Builder(); - } - - public static final class Builder extends CollectorComponent.Builder { - - Collector.Builder delegate = Collector.newBuilder(OpenTelemetryGrpcCollector.class); - CollectorMetrics metrics = CollectorMetrics.NOOP_METRICS; - - @Override public Builder storage(StorageComponent storageComponent) { - delegate.storage(storageComponent); - return this; - } - - @Override public Builder metrics(CollectorMetrics metrics) { - if (metrics == null) throw new NullPointerException("metrics == null"); - delegate.metrics(this.metrics = metrics.forTransport("otel/grpc")); - return this; - } - - @Override public Builder sampler(CollectorSampler sampler) { - delegate.sampler(sampler); - return this; - } - - @Override public OpenTelemetryGrpcCollector build() { - return new OpenTelemetryGrpcCollector(this); - } - - Builder() { - } - } - - final Collector collector; - final CollectorMetrics metrics; - - OpenTelemetryGrpcCollector(Builder builder) { - collector = builder.delegate.build(); - metrics = builder.metrics; - } - - @Override public OpenTelemetryGrpcCollector start() { - return this; - } - @Override public String toString() { - return "OpenTelemetryGrpcCollector{}"; - } - - /** - * Reconfigures the service per https://github.com/open-telemetry/opentelemetry-proto/blob/v1.0.0/opentelemetry/proto/collector/trace/v1/trace_service.proto - */ - @Override public void reconfigure(ServerBuilder sb) { - sb.service("/opentelemetry.proto.collector.trace.v1.TraceService/Export", new HttpService(this)); - } - - static final class HttpService extends AbstractUnsafeUnaryGrpcService { - final OpenTelemetryGrpcCollector collector; - - HttpService(OpenTelemetryGrpcCollector collector) { - this.collector = collector; - } - - @Override - protected CompletionStage handleMessage(ServiceRequestContext ctx, ByteBuf message) { - throw new RuntimeException("Implement me!"); - } - } -} diff --git a/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/ITOpenTelemetryGrpcCollector.java b/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/ITOpenTelemetryGrpcCollector.java deleted file mode 100644 index 99d7e1b..0000000 --- a/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/ITOpenTelemetryGrpcCollector.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin2.collector.otel.grpc; - -import java.io.IOException; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.TestInstance; -import zipkin2.collector.CollectorComponent; -import zipkin2.collector.CollectorSampler; -import zipkin2.collector.InMemoryCollectorMetrics; -import zipkin2.storage.InMemoryStorage; - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -class ITOpenTelemetryGrpcCollector { - InMemoryStorage store; - InMemoryCollectorMetrics metrics; - CollectorComponent collector; - - @BeforeEach public void setup() { - store = InMemoryStorage.newBuilder().build(); - metrics = new InMemoryCollectorMetrics(); - - collector = OpenTelemetryGrpcCollector.newBuilder() - .metrics(metrics) - .sampler(CollectorSampler.ALWAYS_SAMPLE) - .storage(store) - .build() - .start(); - metrics = metrics.forTransport("otel/grpc"); - } - - @AfterEach void teardown() throws IOException { - store.close(); - collector.close(); - } - - // TODO: integration test -} diff --git a/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollectorTest.java b/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollectorTest.java deleted file mode 100644 index 53b33fa..0000000 --- a/collector-grpc/src/test/java/zipkin2/collector/otel/grpc/OpenTelemetryGrpcCollectorTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin2.collector.otel.grpc; - -import org.junit.jupiter.api.Test; -import zipkin2.storage.InMemoryStorage; - -import static org.assertj.core.api.Assertions.assertThat; - -class OpenTelemetryGrpcCollectorTest { - OpenTelemetryGrpcCollector collector = OpenTelemetryGrpcCollector.newBuilder() - .storage(InMemoryStorage.newBuilder().build()) - .build(); - - @Test void check_ok() { - assertThat(collector.check().ok()).isTrue(); - } - - /** - * The output of toString() on {@link zipkin2.collector.Collector} implementations appear in the - * /health endpoint. Make sure it is minimal and human-readable. - */ - @Test void toStringContainsOnlyConfigurableFields() { - assertThat(collector.toString()) - .isEqualTo("OpenTelemetryGrpcCollector{}"); - } -} diff --git a/module/README.md b/module/README.md index 641348c..730f70a 100644 --- a/module/README.md +++ b/module/README.md @@ -4,7 +4,7 @@ This is a module that can be added to a [Zipkin Server](https://github.com/openzipkin/zipkin/tree/master/zipkin-server) -deployment to receive Spans to OpenTelemetry's OLTP/GRPC and OLTP/HTTP protocols. +deployment to receive Spans to OpenTelemetry's OLTP/HTTP protocols. ## Experimental @@ -49,7 +49,6 @@ for users that prefer a file based approach. | Property | Environment Variable | Description | |--------------------------------------|-------------------------------|----------------------------------------------------------| -| `zipkin.collector.otel.grpc.enabled` | `COLLECTOR_GRPC_OTEL_ENABLED` | `false` disables the GRPC collector. Defaults to `true`. | | `zipkin.collector.otel.http.enabled` | `COLLECTOR_HTTP_OTEL_ENABLED` | `false` disables the HTTP collector. Defaults to `true`. | ### Running diff --git a/module/pom.xml b/module/pom.xml index caf72b5..93008ab 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -32,11 +32,6 @@ - - ${project.groupId} - zipkin-collector-otel-grpc - ${project.version} - ${project.groupId} zipkin-collector-otel-http @@ -68,12 +63,6 @@ ${armeria.version} test - - ${armeria.groupId} - armeria-grpc - ${armeria.version} - test - org.awaitility awaitility diff --git a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModule.java b/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModule.java deleted file mode 100644 index ae9e950..0000000 --- a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModule.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin.module.otel; - -import com.linecorp.armeria.spring.ArmeriaServerConfigurator; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import zipkin2.collector.CollectorMetrics; -import zipkin2.collector.CollectorSampler; -import zipkin2.collector.otel.grpc.OpenTelemetryGrpcCollector; -import zipkin2.storage.StorageComponent; - -@Configuration -@ConditionalOnProperty(name = "zipkin.collector.otel.grpc.enabled", matchIfMissing = true) -@EnableConfigurationProperties(ZipkinOpenTelemetryGrpcCollectorProperties.class) -class ZipkinOpenTelemetryGrpcCollectorModule { - @Bean OpenTelemetryGrpcCollector otelGrpcCollector(StorageComponent storage, - CollectorSampler sampler, CollectorMetrics metrics) { - return OpenTelemetryGrpcCollector.newBuilder() - .storage(storage) - .sampler(sampler) - .metrics(metrics) - .build(); - } - - @Bean ArmeriaServerConfigurator otelGrpcCollectorConfigurator( - OpenTelemetryGrpcCollector collector) { - return collector::reconfigure; - } -} diff --git a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorProperties.java b/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorProperties.java deleted file mode 100644 index 31a9c4a..0000000 --- a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorProperties.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin.module.otel; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties("zipkin.collector.otel.grpc") -public class ZipkinOpenTelemetryGrpcCollectorProperties { -} diff --git a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryHttpCollectorModule.java b/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryHttpCollectorModule.java index 49b51d8..6f55d1e 100644 --- a/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryHttpCollectorModule.java +++ b/module/src/main/java/zipkin/module/otel/ZipkinOpenTelemetryHttpCollectorModule.java @@ -20,7 +20,6 @@ import org.springframework.context.annotation.Configuration; import zipkin2.collector.CollectorMetrics; import zipkin2.collector.CollectorSampler; -import zipkin2.collector.otel.grpc.OpenTelemetryGrpcCollector; import zipkin2.collector.otel.http.OpenTelemetryHttpCollector; import zipkin2.storage.StorageComponent; diff --git a/module/src/main/resources/zipkin-server-otel.yml b/module/src/main/resources/zipkin-server-otel.yml index bcf71b3..0095ceb 100644 --- a/module/src/main/resources/zipkin-server-otel.yml +++ b/module/src/main/resources/zipkin-server-otel.yml @@ -2,13 +2,9 @@ zipkin: internal: module: - grpc: zipkin.module.otel.ZipkinOpenTelemetryGrpcCollectorModule http: zipkin.module.otel.ZipkinOpenTelemetryHttpCollectorModule collector: otel: - grpc: - # Set to false to disable creation of spans via OLTP/GRPC protocol - enabled: ${COLLECTOR_GRPC_ENABLED:${COLLECTOR_OTEL_GRPC_ENABLED:true}} http: # Set to false to disable creation of spans via OLTP/HTTP protocol enabled: ${COLLECTOR_HTTP_ENABLED:${COLLECTOR_OTEL_HTTP_ENABLED:true}} diff --git a/module/src/test/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModuleTest.java b/module/src/test/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModuleTest.java deleted file mode 100644 index bc9a07b..0000000 --- a/module/src/test/java/zipkin/module/otel/ZipkinOpenTelemetryGrpcCollectorModuleTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2024 The OpenZipkin Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package zipkin.module.otel; - -import com.linecorp.armeria.spring.ArmeriaServerConfigurator; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import zipkin2.collector.CollectorMetrics; -import zipkin2.collector.CollectorSampler; -import zipkin2.collector.otel.grpc.OpenTelemetryGrpcCollector; -import zipkin2.storage.InMemoryStorage; -import zipkin2.storage.StorageComponent; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; - -class ZipkinOpenTelemetryGrpcCollectorModuleTest { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - @AfterEach void close() { - context.close(); - } - - @Test void grpcCollector_enabledByDefault() { - context.register( - ZipkinOpenTelemetryGrpcCollectorProperties.class, - ZipkinOpenTelemetryGrpcCollectorModule.class, - InMemoryConfiguration.class - ); - context.refresh(); - - assertThat(context.getBean(OpenTelemetryGrpcCollector.class)).isNotNull(); - assertThat(context.getBean(ArmeriaServerConfigurator.class)).isNotNull(); - } - - @Test void grpcCollector_canDisable() { - assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() -> { - TestPropertyValues.of("zipkin.collector.otel.grpc.enabled:false").applyTo(context); - context.register( - ZipkinOpenTelemetryGrpcCollectorProperties.class, - ZipkinOpenTelemetryGrpcCollectorModule.class, - InMemoryConfiguration.class - ); - context.refresh(); - - context.getBean(OpenTelemetryGrpcCollector.class); - }); - } - - @Configuration - static class InMemoryConfiguration { - @Bean CollectorSampler sampler() { - return CollectorSampler.ALWAYS_SAMPLE; - } - - @Bean CollectorMetrics metrics() { - return CollectorMetrics.NOOP_METRICS; - } - - @Bean StorageComponent storage() { - return InMemoryStorage.newBuilder().build(); - } - } -} diff --git a/pom.xml b/pom.xml index 915f434..1f51392 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,6 @@ module - collector-grpc collector-http