From 3e650f00a11b67c4c30d03fe2d2eaf30c400f217 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:15:15 -0500 Subject: [PATCH 1/4] fix(deps): update dependency io.opentelemetry.semconv:opentelemetry-semconv-incubating to v1.28.0-alpha (#6792) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- dependencyManagement/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index 9194798c861..806ed9abaa2 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -67,7 +67,7 @@ val DEPENDENCIES = listOf( "io.github.netmikey.logunit:logunit-jul:2.0.0", "io.jaegertracing:jaeger-client:1.8.1", "io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.39.0-alpha", - "io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.27.0-alpha", + "io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha", "io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha", "io.opentracing:opentracing-api:0.33.0", "io.opentracing:opentracing-noop:0.33.0", From 83b30b5d0e58158ba3e42d334aadde77fe614bd7 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 15 Oct 2024 11:13:51 -0700 Subject: [PATCH 2/4] Bump config file format version (#6786) --- .../sdk/autoconfigure/FileConfigurationTest.java | 2 +- .../sdk/autoconfigure/FileConfigurationTest.java | 4 ++-- sdk-extensions/incubator/build.gradle.kts | 7 +++++-- .../OpenTelemetryConfigurationFactory.java | 4 ++-- .../fileconfig/FileConfigurationCreateTest.java | 2 +- .../fileconfig/FileConfigurationParseTest.java | 12 ++++++------ .../OpenTelemetryConfigurationFactoryTest.java | 8 ++++---- .../YamlStructuredConfigPropertiesTest.java | 4 ++-- 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java index e3a9bb3ed10..955e5817693 100644 --- a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java +++ b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java @@ -31,7 +31,7 @@ class FileConfigurationTest { @Test void configFile(@TempDir Path tempDir) throws IOException { String yaml = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "resource:\n" + " attributes:\n" + " - name: service.name\n" diff --git a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java index 3b3869e5bf6..7eface52c5e 100644 --- a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java +++ b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FileConfigurationTest.java @@ -55,7 +55,7 @@ class FileConfigurationTest { @BeforeEach void setup() throws IOException { String yaml = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "resource:\n" + " attributes:\n" + " - name: service.name\n" @@ -160,7 +160,7 @@ void configFile_setResultAsGlobalTrue() { @Test void configFile_Error(@TempDir Path tempDir) throws IOException { String yaml = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "resource:\n" + " attributes:\n" + " - name: service.name\n" diff --git a/sdk-extensions/incubator/build.gradle.kts b/sdk-extensions/incubator/build.gradle.kts index 59acac261ef..92be979672f 100644 --- a/sdk-extensions/incubator/build.gradle.kts +++ b/sdk-extensions/incubator/build.gradle.kts @@ -56,8 +56,11 @@ dependencies { // 7. deleteJs2pTmp - delete tmp directory // ... proceed with normal sourcesJar, compileJava, etc -val configurationTag = "0.3.0" -val configurationRef = "refs/tags/v$configurationTag" // Replace with commit SHA to point to experiment with a specific commit +// TODO (trask) revert after the 0.4.0 release +// it was needed after 0.3.0 release because file_format in the examples weren't updated prior to the release tag +// val configurationTag = "0.3.0" +// val configurationRef = "refs/tags/v$configurationTag" // Replace with commit SHA to point to experiment with a specific commit +val configurationRef = "cea3905ce0a542d573968c3c47d413143d473cf4" val configurationRepoZip = "https://github.com/open-telemetry/opentelemetry-configuration/archive/$configurationRef.zip" val buildDirectory = layout.buildDirectory.asFile.get() diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java index 0213839ee30..5df6a4766a3 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java @@ -31,8 +31,8 @@ static OpenTelemetryConfigurationFactory getInstance() { public OpenTelemetrySdk create( OpenTelemetryConfigurationModel model, SpiHelper spiHelper, List closeables) { OpenTelemetrySdkBuilder builder = OpenTelemetrySdk.builder(); - if (!"0.1".equals(model.getFileFormat())) { - throw new ConfigurationException("Unsupported file format. Supported formats include: 0.1"); + if (!"0.3".equals(model.getFileFormat())) { + throw new ConfigurationException("Unsupported file format. Supported formats include: 0.3"); } if (Objects.equals(Boolean.TRUE, model.getDisabled())) { diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationCreateTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationCreateTest.java index d47ae14eb9a..c1a97a8e265 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationCreateTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationCreateTest.java @@ -103,7 +103,7 @@ void parseAndCreate_Exception_CleansUpPartials() { // exporter with OTLP exporter, following by invalid batch exporter which references invalid // exporter "foo". String yaml = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "logger_provider:\n" + " processors:\n" + " - batch:\n" diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java index 81aa6f4487e..b90c154205a 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java @@ -92,7 +92,7 @@ void parse_BadInputStream() { void parse_KitchenSinkExampleFile() throws IOException { OpenTelemetryConfigurationModel expected = new OpenTelemetryConfigurationModel(); - expected.withFileFormat("0.1"); + expected.withFileFormat("0.3"); expected.withDisabled(false); // General config @@ -449,7 +449,7 @@ void parse_KitchenSinkExampleFile() throws IOException { OpenTelemetryConfigurationModel config = FileConfiguration.parse(configExampleFile); // General config - assertThat(config.getFileFormat()).isEqualTo("0.1"); + assertThat(config.getFileFormat()).isEqualTo("0.3"); assertThat(config.getResource()).isEqualTo(resource); assertThat(config.getAttributeLimits()).isEqualTo(attributeLimits); assertThat(config.getPropagator()).isEqualTo(propagator); @@ -485,7 +485,7 @@ void parse_KitchenSinkExampleFile() throws IOException { @Test void parse_nullValuesParsedToEmptyObjects() { String objectPlaceholderString = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "tracer_provider:\n" + " processors:\n" + " - batch:\n" @@ -503,7 +503,7 @@ void parse_nullValuesParsedToEmptyObjects() { new ByteArrayInputStream(objectPlaceholderString.getBytes(StandardCharsets.UTF_8))); String noOjbectPlaceholderString = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "tracer_provider:\n" + " processors:\n" + " - batch:\n" @@ -672,7 +672,7 @@ private static Map mapOf(Map.Entry... entries) { @Test void read_WithEnvironmentVariables() { String yaml = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "tracer_provider:\n" + " processors:\n" + " - batch:\n" @@ -691,7 +691,7 @@ void read_WithEnvironmentVariables() { assertThat(model) .isEqualTo( new OpenTelemetryConfigurationModel() - .withFileFormat("0.1") + .withFileFormat("0.3") .withTracerProvider( new TracerProviderModel() .withProcessors( diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java index 0284a16bac4..5630ea99767 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java @@ -83,7 +83,7 @@ void create_InvalidFileFormat() { OpenTelemetryConfigurationFactory.getInstance() .create(testCase, spiHelper, closeables)) .isInstanceOf(ConfigurationException.class) - .hasMessage("Unsupported file format. Supported formats include: 0.1"); + .hasMessage("Unsupported file format. Supported formats include: 0.3"); cleanup.addCloseables(closeables); } } @@ -97,7 +97,7 @@ void create_Defaults() { OpenTelemetrySdk sdk = OpenTelemetryConfigurationFactory.getInstance() .create( - new OpenTelemetryConfigurationModel().withFileFormat("0.1"), spiHelper, closeables); + new OpenTelemetryConfigurationModel().withFileFormat("0.3"), spiHelper, closeables); cleanup.addCloseable(sdk); cleanup.addCloseables(closeables); @@ -114,7 +114,7 @@ void create_Disabled() { OpenTelemetryConfigurationFactory.getInstance() .create( new OpenTelemetryConfigurationModel() - .withFileFormat("0.1") + .withFileFormat("0.3") .withDisabled(true) // Logger provider configuration should be ignored since SDK is disabled .withLoggerProvider( @@ -208,7 +208,7 @@ void create_Configured() { OpenTelemetryConfigurationFactory.getInstance() .create( new OpenTelemetryConfigurationModel() - .withFileFormat("0.1") + .withFileFormat("0.3") .withPropagator( new PropagatorModel() .withComposite( diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java index 757331934bf..25f9a877c95 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java @@ -22,7 +22,7 @@ class YamlStructuredConfigPropertiesTest { private static final String extendedSchema = - "file_format: \"0.1\"\n" + "file_format: \"0.3\"\n" + "disabled: false\n" + "\n" + "resource:\n" @@ -69,7 +69,7 @@ void setup() { @Test void configurationSchema() { // Validate can read file configuration schema properties - assertThat(structuredConfigProps.getString("file_format")).isEqualTo("0.1"); + assertThat(structuredConfigProps.getString("file_format")).isEqualTo("0.3"); StructuredConfigProperties resourceProps = structuredConfigProps.getStructured("resource"); assertThat(resourceProps).isNotNull(); List resourceAttributesList = From 8194c10b785b7f8d232b4bce0b5f70c91669201a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 16 Oct 2024 02:14:45 +0200 Subject: [PATCH 3/4] add Reproducible Builds badge (#6788) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3356c358bc7..3503236b277 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Continuous Build][ci-image]][ci-url] [![Coverage Status][codecov-image]][codecov-url] [![Maven Central][maven-image]][maven-url] +[![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/io/opentelemetry/java/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/io/opentelemetry/java/README.md) ## Project Status From 537f5c4e79e99f82dae53d16f7167caf7041a0c3 Mon Sep 17 00:00:00 2001 From: jack-berg <34418638+jack-berg@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:39:12 -0500 Subject: [PATCH 4/4] Fix declarative config env substitution by disallowing '}' in default value (#6793) --- .../sdk/extension/incubator/fileconfig/FileConfiguration.java | 2 +- .../incubator/fileconfig/FileConfigurationParseTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java index 76cf9cc1fbe..e4004516b73 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java @@ -49,7 +49,7 @@ public final class FileConfiguration { private static final Logger logger = Logger.getLogger(FileConfiguration.class.getName()); private static final Pattern ENV_VARIABLE_REFERENCE = - Pattern.compile("\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)(:-([^\n]*))?\\}"); + Pattern.compile("\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)(:-([^\n}]*))?}"); private static final ComponentLoader DEFAULT_COMPONENT_LOADER = SpiHelper.serviceComponentLoader(FileConfiguration.class.getClassLoader()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java index b90c154205a..7de63dcb45c 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java @@ -634,6 +634,9 @@ private static java.util.stream.Stream envVarSubstitutionArgs() { // Multiple environment variables referenced Arguments.of("key1: ${STR_1}${STR_2}\n", mapOf(entry("key1", "value1value2"))), Arguments.of("key1: ${STR_1} ${STR_2}\n", mapOf(entry("key1", "value1 value2"))), + Arguments.of( + "key1: ${STR_1} ${NOT_SET:-default} ${STR_2}\n", + mapOf(entry("key1", "value1 default value2"))), // Undefined / empty environment variable Arguments.of("key1: ${EMPTY_STR}\n", mapOf(entry("key1", null))), Arguments.of("key1: ${STR_3}\n", mapOf(entry("key1", null))),