Skip to content

Commit

Permalink
change template to otel.instrumentation.resource-provider.%s.enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed Mar 5, 2024
1 parent bca96f1 commit 602ee35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ResourceProviderPropertiesCustomizer implements AutoConfigurationCu
DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS.put(
"io.opentelemetry.contrib.aws.resource.LambdaResourceProvider", "aws");
DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS.put(
"io.opentelemetry.contrib.gcp.resource.GCPResourceProvider", "aws");
"io.opentelemetry.contrib.gcp.resource.GCPResourceProvider", "gcp");
// for testing
DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS.put(
"io.opentelemetry.javaagent.tooling.config.ResourceProviderPropertiesCustomizerTest$Provider",
Expand All @@ -62,7 +62,8 @@ Map<String, String> customize(ConfigProperties config) {
String providerName = providerEntry.getKey();
String providerGroup = providerEntry.getValue();
Boolean explictEnabled =
config.getBoolean(String.format("otel.instrumentation.%s.enabled", providerGroup));
config.getBoolean(
String.format("otel.instrumentation.resource-provider.%s.enabled", providerGroup));

if (isEnabled(providerName, enabledProviders, explictEnabled)) {
enabled.add(providerName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
import io.opentelemetry.sdk.autoconfigure.SdkAutoconfigureAccess;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -25,8 +26,7 @@

public class ResourceProviderPropertiesCustomizerTest {

public static final class Provider
implements io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider {
public static final class Provider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
return Resource.create(Attributes.of(AttributeKey.stringKey("key"), "value"));
Expand Down Expand Up @@ -115,7 +115,7 @@ Stream<DynamicTest> enabledTestCases() {

if (tc.explicitEnabled != null) {
props.put(
"otel.instrumentation.test.enabled",
"otel.instrumentation.resource-provider.test.enabled",
Boolean.toString(tc.explicitEnabled));
}

Expand Down

0 comments on commit 602ee35

Please sign in to comment.