From 9a81796e62322451103e3536c9d4decea156c6be Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 6 Sep 2024 09:45:58 +0200 Subject: [PATCH] Polish "Reapply "Merge pull request #41213 from timpeeters"" See gh-41213 --- .../otlp/OtlpLoggingProperties.java | 15 +------- .../opentelemetry/otlp/Compression.java | 37 +++++++++++++++++++ .../opentelemetry/otlp/Transport.java | 37 +++++++++++++++++++ .../opentelemetry/otlp/package-info.java | 20 ++++++++++ .../tracing/otlp/OtlpProperties.java | 30 +-------------- ...itional-spring-configuration-metadata.json | 4 -- 6 files changed, 97 insertions(+), 46 deletions(-) create mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Compression.java create mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Transport.java create mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/package-info.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/opentelemetry/otlp/OtlpLoggingProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/opentelemetry/otlp/OtlpLoggingProperties.java index b7d484a946..c41d6d9a83 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/opentelemetry/otlp/OtlpLoggingProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/opentelemetry/otlp/OtlpLoggingProperties.java @@ -20,6 +20,7 @@ import java.time.Duration; import java.util.HashMap; import java.util.Map; +import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Compression; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -82,18 +83,4 @@ public class OtlpLoggingProperties { return this.headers; } - public enum Compression { - - /** - * Gzip compression. - */ - GZIP, - - /** - * No compression. - */ - NONE - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Compression.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Compression.java new file mode 100644 index 0000000000..15183900d4 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Compression.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012-2024 the original author or 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 + * + * https://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 org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp; + +/** + * Algorithm used to compress OTLP data. + * + * @author Moritz Halbritter + * @since 3.4.0 + */ +public enum Compression { + + /** + * Gzip compression. + */ + GZIP, + + /** + * No compression. + */ + NONE + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Transport.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Transport.java new file mode 100644 index 0000000000..443a263a39 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/Transport.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012-2024 the original author or 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 + * + * https://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 org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp; + +/** + * Transport used to send OTLP data. + * + * @author Moritz Halbritter + * @since 3.4.0 + */ +public enum Transport { + + /** + * HTTP transport. + */ + HTTP, + + /** + * gRPC transport. + */ + GRPC + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/package-info.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/package-info.java new file mode 100644 index 0000000000..519a94919d --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/opentelemetry/otlp/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2023 the original author or 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 + * + * https://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. + */ + +/** + * Classes for OpenTelemetry's OTLP. + */ +package org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java index 16c16e67c0..fe1ae7836a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java @@ -20,6 +20,8 @@ import java.time.Duration; import java.util.HashMap; import java.util.Map; +import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Compression; +import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -99,32 +101,4 @@ public class OtlpProperties { this.headers = headers; } - public enum Transport { - - /** - * HTTP transport. - */ - HTTP, - - /** - * gRPC transport. - */ - GRPC - - } - - public enum Compression { - - /** - * Gzip compression. - */ - GZIP, - - /** - * No compression. - */ - NONE - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index f62c3cb21b..5304c1a536 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -2058,10 +2058,6 @@ "type": "java.lang.Boolean", "description": "Whether auto-configuration of tracing is enabled to export OTLP traces." }, - { - "name": "management.otlp.tracing.transport", - "defaultValue": "http" - }, { "name": "management.server.add-application-context-header", "type": "java.lang.Boolean",