Skip to content

Commit

Permalink
add support for missing list properties in spring starter (#12434)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean Bisutti <jean.bisutti@gmail.com>
  • Loading branch information
zeitlinger and jeanbisutti authored Oct 16, 2024
1 parent 780cdf4 commit 9e83898
Show file tree
Hide file tree
Showing 12 changed files with 386 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Comparing source compatibility of opentelemetry-spring-boot-autoconfigure-2.9.0-SNAPSHOT.jar against opentelemetry-spring-boot-autoconfigure-2.8.0.jar
No changes.
=== UNCHANGED CLASS: PUBLIC io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
*** MODIFIED ANNOTATION: org.springframework.boot.context.properties.EnableConfigurationProperties
*** MODIFIED ELEMENT: value=io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelSpringProperties (<- io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.PropagationProperties)
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.MapConverter;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.SdkEnabled;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelSpringProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.PropagationProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.SpringConfigProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.DistroVersionResourceProvider;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.SpringResourceProvider;
Expand Down Expand Up @@ -51,7 +51,7 @@
@EnableConfigurationProperties({
OtlpExporterProperties.class,
OtelResourceProperties.class,
PropagationProperties.class
OtelSpringProperties.class
})
public class OpenTelemetryAutoConfiguration {

Expand Down Expand Up @@ -90,7 +90,7 @@ public AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk(
Environment env,
OtlpExporterProperties otlpExporterProperties,
OtelResourceProperties resourceProperties,
PropagationProperties propagationProperties,
OtelSpringProperties otelSpringProperties,
OpenTelemetrySdkComponentLoader componentLoader) {

return AutoConfigureUtil.setComponentLoader(
Expand All @@ -101,7 +101,7 @@ public AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk(
env,
otlpExporterProperties,
resourceProperties,
propagationProperties,
otelSpringProperties,
c)),
componentLoader)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties;

import java.util.Collections;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
// yaml lists only work if you create a @ConfigurationProperties object
@ConfigurationProperties(prefix = "otel")
public final class OtelSpringProperties {

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public static final class Java {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public static final class Enabled {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can
* change at any time.
*/
public static final class Resource {
private List<String> providers = Collections.emptyList();

public List<String> getProviders() {
return providers;
}

public void setProviders(List<String> providers) {
this.providers = providers;
}
}

private Enabled.Resource resource = new Enabled.Resource();

public Enabled.Resource getResource() {
return resource;
}

public void setResource(Enabled.Resource resource) {
this.resource = resource;
}
}

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public static final class Disabled {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can
* change at any time.
*/
public static final class Resource {
private List<String> providers = Collections.emptyList();

public List<String> getProviders() {
return providers;
}

public void setProviders(List<String> providers) {
this.providers = providers;
}
}

private Disabled.Resource resource = new Disabled.Resource();

public Disabled.Resource getResource() {
return resource;
}

public void setResource(Disabled.Resource resource) {
this.resource = resource;
}
}

private Enabled enabled = new Enabled();
private Java.Disabled disabled = new Java.Disabled();

public Enabled getEnabled() {
return enabled;
}

public void setEnabled(Enabled enabled) {
this.enabled = enabled;
}

public Java.Disabled getDisabled() {
return disabled;
}

public void setDisabled(Java.Disabled disabled) {
this.disabled = disabled;
}
}

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public static final class Experimental {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public static final class Metrics {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can
* change at any time.
*/
public static final class View {
private List<String> config = Collections.emptyList();

public List<String> getConfig() {
return config;
}

public void setConfig(List<String> config) {
this.config = config;
}
}

private View view = new View();

public View getView() {
return view;
}

public void setView(View view) {
this.view = view;
}
}

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public static final class Resource {
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can
* change at any time.
*/
public static final class Disabled {
private List<String> keys = Collections.emptyList();

public List<String> getKeys() {
return keys;
}

public void setKeys(List<String> keys) {
this.keys = keys;
}
}

private Resource.Disabled disabled = new Resource.Disabled();

public Resource.Disabled getDisabled() {
return disabled;
}

public void setDisabled(Resource.Disabled disabled) {
this.disabled = disabled;
}
}

private Metrics metrics = new Metrics();
private Resource resource = new Resource();

public Metrics getMetrics() {
return metrics;
}

public void setMetrics(Metrics metrics) {
this.metrics = metrics;
}

public Resource getResource() {
return resource;
}

public void setResource(Resource resource) {
this.resource = resource;
}
}

private List<String> propagators = Collections.emptyList();

private Java java = new Java();

private Experimental experimental = new Experimental();

public List<String> getPropagators() {
return propagators;
}

public void setPropagators(List<String> propagators) {
this.propagators = propagators;
}

public Java getJava() {
return java;
}

public void setJava(Java java) {
this.java = java;
}

public Experimental getExperimental() {
return experimental;
}

public void setExperimental(Experimental experimental) {
this.experimental = experimental;
}

public List<String> getJavaEnabledResourceProviders() {
return java.getEnabled().getResource().getProviders();
}

public List<String> getJavaDisabledResourceProviders() {
return java.getDisabled().getResource().getProviders();
}

public List<String> getExperimentalMetricsViewConfig() {
return experimental.getMetrics().getView().getConfig();
}

public List<String> getExperimentalResourceDisabledKeys() {
return experimental.getResource().getDisabled().getKeys();
}
}

This file was deleted.

Loading

0 comments on commit 9e83898

Please sign in to comment.