Skip to content
Open
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 @@ -49,10 +49,27 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {

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

private static final SpanSuppressionStrategy spanSuppressionStrategy =
SpanSuppressionStrategy.fromConfig(
private static final SpanSuppressionStrategy spanSuppressionStrategy;

static {
String value =
ConfigPropertiesUtil.getString(
"otel.instrumentation.common.experimental.span-suppression-strategy");

if (value == null) {
value =
ConfigPropertiesUtil.getString(
"otel.instrumentation.experimental.span-suppression-strategy"));
"otel.instrumentation.experimental.span-suppression-strategy");

if (value != null) {
logger.warning(
"Using deprecated config: otel.instrumentation.experimental.span-suppression-strategy. "
+ "Use otel.instrumentation.common.experimental.span-suppression-strategy instead.");
}
}

spanSuppressionStrategy = SpanSuppressionStrategy.fromConfig(value);
}

final OpenTelemetry openTelemetry;
final String instrumentationName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.api.internal;

import static java.util.Collections.emptyList;
import static java.util.logging.Level.WARNING;

import java.util.List;
import java.util.logging.Logger;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@SuppressWarnings("unused")
public final class DeprecatedConfigProperties {

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

public static boolean getBoolean(
String deprecatedPropertyName, String newPropertyName, boolean defaultValue) {

warnIfUsed(deprecatedPropertyName, newPropertyName);

boolean value = ConfigPropertiesUtil.getBoolean(deprecatedPropertyName, defaultValue);
return ConfigPropertiesUtil.getBoolean(newPropertyName, value);
}

public static List<String> getList(String deprecatedPropertyName, String newPropertyName) {

warnIfUsed(deprecatedPropertyName, newPropertyName);

List<String> value = ConfigPropertiesUtil.getList(deprecatedPropertyName, emptyList());
return ConfigPropertiesUtil.getList(newPropertyName, value);
}

private static void warnIfUsed(String deprecatedPropertyName, String newPropertyName) {
if (ConfigPropertiesUtil.getString(deprecatedPropertyName) != null) {
logger.log(
WARNING,
"Deprecated property \"{0}\" was used; use the \"{1}\" property instead",
new Object[] {deprecatedPropertyName, newPropertyName});
}
}

private DeprecatedConfigProperties() {}
}
2 changes: 1 addition & 1 deletion instrumentation/camel-2.20/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ tasks {
jvmArgs("-Dotel.instrumentation.aws-sdk.experimental-span-attributes=true")

// TODO: fix camel instrumentation so that it uses semantic attributes extractors
jvmArgs("-Dotel.instrumentation.experimental.span-suppression-strategy=span-kind")
jvmArgs("-Dotel.instrumentation.common.experimental.span-suppression-strategy=span-kind")

// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ private static void installEarlyInstrumentation(
}

private static void copyNecessaryConfigToSystemProperties(ConfigProperties config) {
for (String property : asList("otel.instrumentation.experimental.span-suppression-strategy")) {
for (String property :
asList("otel.instrumentation.common.experimental.span-suppression-strategy")) {
String value = config.getString(property);
if (value != null) {
System.setProperty(property, value);
Expand Down
Loading