Skip to content

Commit

Permalink
Remove support for deprecated otel.experimental.resource.disabled.keys (
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Dec 6, 2024
1 parent e61e19a commit 1f8ee51
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.logging.Logger;

/**
* Auto-configuration for the OpenTelemetry {@link Resource}.
Expand All @@ -34,15 +33,11 @@
*/
public final class ResourceConfiguration {

private static final Logger logger = Logger.getLogger(ResourceConfiguration.class.getName());

private static final AttributeKey<String> SERVICE_NAME = AttributeKey.stringKey("service.name");

// Visible for testing
static final String ATTRIBUTE_PROPERTY = "otel.resource.attributes";
static final String SERVICE_NAME_PROPERTY = "otel.service.name";
static final String EXPERIMENTAL_DISABLED_ATTRIBUTE_KEYS =
"otel.experimental.resource.disabled.keys";
static final String DISABLED_ATTRIBUTE_KEYS = "otel.resource.disabled.keys";

/**
Expand Down Expand Up @@ -120,14 +115,6 @@ static Resource configureResource(
// visible for testing
static Resource filterAttributes(Resource resource, ConfigProperties configProperties) {
List<String> disabledAttibuteKeys = configProperties.getList(DISABLED_ATTRIBUTE_KEYS);
// TODO: Remove this once the deprecated property is removed.
if (disabledAttibuteKeys.isEmpty()) {
disabledAttibuteKeys = configProperties.getList(EXPERIMENTAL_DISABLED_ATTRIBUTE_KEYS);
if (!disabledAttibuteKeys.isEmpty()) {
logger.warning(
"otel.experimental.resource.disabled.keys is deprecated and will be removed after 1.45.0 release. Please use otel.resource.disabled.keys instead.");
}
}
Set<String> disabledKeys = new HashSet<>(disabledAttibuteKeys);

ResourceBuilder builder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,6 @@ void customConfigResourceWithDisabledKeys() {
.build());
}

@Test
void customConfigResourceWithExperimentalDisabledKeys() {
Map<String, String> props = new HashMap<>();
props.put("otel.service.name", "test-service");
props.put(
"otel.resource.attributes", "food=cheesecake,drink=juice,animal= ,color=,shape=square");
props.put("otel.experimental.resource.disabled-keys", "drink");

assertThat(
ResourceConfiguration.configureResource(
DefaultConfigProperties.create(props),
SpiHelper.create(ResourceConfigurationTest.class.getClassLoader()),
(r, c) -> r))
.isEqualTo(
Resource.getDefault().toBuilder()
.put(stringKey("service.name"), "test-service")
.put("food", "cheesecake")
.put("shape", "square")
.build());
}

@Test
void createEnvironmentResource_Empty() {
Attributes attributes = ResourceConfiguration.createEnvironmentResource().getAttributes();
Expand Down

0 comments on commit 1f8ee51

Please sign in to comment.