Skip to content

Remove support for deprecated otel.experimental.resource.disabled.keys #6931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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 @@ -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
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy