Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
import io.opentelemetry.api.incubator.config.InstrumentationConfigUtil;
import io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration;
import io.opentelemetry.sdk.extension.incubator.fileconfig.SdkConfigProvider;
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExperimentalInstrumentationModel;
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExperimentalLanguageSpecificInstrumentationModel;
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.InstrumentationModel;
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExperimentalLanguageSpecificInstrumentationPropertyModel;
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -72,7 +73,9 @@ void getInstrumentationConfigModel_UnsetConfig() {
@Test
void getInstrumentationConfigModel_EmptyConfig() {
ConfigProvider configProvider =
withInstrumentationConfig("my_instrumentation_library", Collections.emptyMap());
withInstrumentationConfig(
"my_instrumentation_library",
new ExperimentalLanguageSpecificInstrumentationPropertyModel());

assertThat(
InstrumentationConfigUtil.getInstrumentationConfigModel(
Expand All @@ -85,21 +88,20 @@ void getInstrumentationConfigModel_KitchenSink() {
ConfigProvider configProvider =
withInstrumentationConfig(
"my_instrumentation_library",
ImmutableMap.<String, Object>builder()
.put("string_property", "value")
.put("boolean_property", true)
.put("long_property", 1L)
.put("double_property", 1.1d)
.put("string_list_property", Arrays.asList("val1", "val2"))
.put("boolean_list_property", Arrays.asList(true, false))
.put("long_list_property", Arrays.asList(1L, 2L))
.put("double_list_property", Arrays.asList(1.1d, 2.2d))
.put("map_property", Collections.singletonMap("childKey", "val"))
.put(
new ExperimentalLanguageSpecificInstrumentationPropertyModel()
.withAdditionalProperty("string_property", "value")
.withAdditionalProperty("boolean_property", true)
.withAdditionalProperty("long_property", 1L)
.withAdditionalProperty("double_property", 1.1d)
.withAdditionalProperty("string_list_property", Arrays.asList("val1", "val2"))
.withAdditionalProperty("boolean_list_property", Arrays.asList(true, false))
.withAdditionalProperty("long_list_property", Arrays.asList(1L, 2L))
.withAdditionalProperty("double_list_property", Arrays.asList(1.1d, 2.2d))
.withAdditionalProperty("map_property", Collections.singletonMap("childKey", "val"))
.withAdditionalProperty(
"structured_list_property",
Collections.singletonList(
ImmutableMap.of("key", "the_key", "value", "the_value")))
.build());
ImmutableMap.of("key", "the_key", "value", "the_value"))));

Model expected = new Model();
expected.stringProperty = "value";
Expand All @@ -123,14 +125,16 @@ void getInstrumentationConfigModel_KitchenSink() {
}

private static ConfigProvider withInstrumentationConfig(
String instrumentationName, Map<String, Object> instrumentationConfig) {
String instrumentationName,
ExperimentalLanguageSpecificInstrumentationPropertyModel instrumentationConfig) {
ExperimentalLanguageSpecificInstrumentationModel javaConfig =
new ExperimentalLanguageSpecificInstrumentationModel();
javaConfig.setAdditionalProperty(instrumentationName, instrumentationConfig);

return SdkConfigProvider.create(
new OpenTelemetryConfigurationModel()
.withInstrumentationDevelopment(new InstrumentationModel().withJava(javaConfig)));
.withInstrumentationDevelopment(
new ExperimentalInstrumentationModel().withJava(javaConfig)));
}

private static class Model {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ public static void configureOtlpExporterBuilder(
setTimeout.accept(Duration.ofMillis(timeoutMs));
}

String certificatePath = config.getString("certificate_file");
String clientKeyPath = config.getString("client_key_file");
String clientKeyChainPath = config.getString("client_certificate_file");
DeclarativeConfigProperties tls =
config.getStructured("tls", DeclarativeConfigProperties.empty());
String certificatePath = tls.getString("ca_file");
String clientKeyPath = tls.getString("key_file");
String clientKeyChainPath = tls.getString("cert_file");

if (clientKeyPath != null && clientKeyChainPath == null) {
throw new ConfigurationException(
Expand Down

This file was deleted.

This file was deleted.

24 changes: 10 additions & 14 deletions sdk-extensions/incubator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import de.undercouch.gradle.tasks.download.Download
import java.io.FileFilter

plugins {
id("otel.java-conventions")
Expand Down Expand Up @@ -37,7 +38,6 @@ dependencies {
testImplementation(project(":exporters:logging-otlp"))
testImplementation(project(":exporters:otlp:all"))
testImplementation(project(":exporters:prometheus"))
testImplementation(project(":exporters:zipkin"))
testImplementation(project(":sdk-extensions:jaeger-remote-sampler"))
testImplementation(project(":extensions:trace-propagators"))
testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
Expand All @@ -51,14 +51,13 @@ dependencies {
// The sequence of tasks is:
// 1. downloadConfigurationSchema - download configuration schema from open-telemetry/opentelemetry-configuration
// 2. unzipConfigurationSchema - unzip the configuration schema archive contents to $buildDir/configuration/
// 3. deleteTypeDescriptions - delete type_descriptions.yaml $buildDir/configuration/schema, which is not part of core schema and causes problems resolving type refs
// 4. generateJsonSchema2Pojo - generate java POJOs from the configuration schema
// 5. jsonSchema2PojoPostProcessing - perform various post processing on the generated POJOs, e.g. replace javax.annotation.processing.Generated with javax.annotation.Generated, add @SuppressWarning("rawtypes") annotation
// 6. overwriteJs2p - overwrite original generated classes with versions containing updated @Generated annotation
// 7. deleteJs2pTmp - delete tmp directory
// 3. generateJsonSchema2Pojo - generate java POJOs from the configuration schema
// 4. jsonSchema2PojoPostProcessing - perform various post processing on the generated POJOs, e.g. replace javax.annotation.processing.Generated with javax.annotation.Generated, add @SuppressWarning("rawtypes") annotation
// 5. overwriteJs2p - overwrite original generated classes with versions containing updated @Generated annotation
// 6. deleteJs2pTmp - delete tmp directory
// ... proceed with normal sourcesJar, compileJava, etc

val configurationTag = "1.0.0-rc.1"
val configurationTag = "1.0.0-rc.3"
val configurationRef = "refs/tags/v$configurationTag" // Replace with commit SHA to point to experiment with a specific commit
val configurationRepoZip = "https://github.com/open-telemetry/opentelemetry-configuration/archive/$configurationRef.zip"
val buildDirectory = layout.buildDirectory.asFile.get()
Expand All @@ -81,13 +80,8 @@ val unzipConfigurationSchema by tasks.registering(Copy::class) {
into("$buildDirectory/configuration/")
}

val deleteTypeDescriptions by tasks.registering(Delete::class) {
dependsOn(unzipConfigurationSchema)
delete("$buildDirectory/configuration/schema/type_descriptions.yaml")
}

jsonSchema2Pojo {
sourceFiles = setOf(file("$buildDirectory/configuration/schema"))
sourceFiles = setOf(file("$buildDirectory/configuration/opentelemetry_configuration.json"))
targetDirectory = file("$buildDirectory/generated/sources/js2p/java/main")
targetPackage = "io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model"

Expand All @@ -114,7 +108,7 @@ jsonSchema2Pojo {
}

val generateJsonSchema2Pojo = tasks.getByName("generateJsonSchema2Pojo")
generateJsonSchema2Pojo.dependsOn(deleteTypeDescriptions)
generateJsonSchema2Pojo.dependsOn(unzipConfigurationSchema)

val jsonSchema2PojoPostProcessing by tasks.registering(Copy::class) {
dependsOn(generateJsonSchema2Pojo)
Expand Down Expand Up @@ -204,9 +198,11 @@ val buildGraalVmReflectionJson = tasks.register("buildGraalVmReflectionJson") {
tasks.getByName("compileJava").dependsOn(deleteJs2pTmp)
tasks.getByName("sourcesJar").dependsOn(deleteJs2pTmp, buildGraalVmReflectionJson)
tasks.getByName("jar").dependsOn(deleteJs2pTmp, buildGraalVmReflectionJson)
tasks.getByName("javadoc").dependsOn(buildGraalVmReflectionJson)

// Exclude jsonschema2pojo generated sources from checkstyle
tasks.named<Checkstyle>("checkstyleMain") {
dependsOn(buildGraalVmReflectionJson)
exclude("**/fileconfig/internal/model/**")
}

Expand Down
Loading
Loading