Remove deprecated code from instrumentation-api, extension-api
MODIFY
instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java
instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java
@@ -21,11 +21,8 @@ public enum MessageOperation {
* Returns the operation name as defined in <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md#operation-names">the
* specification</a>.
- *
- * @deprecated This method is going to be made non-public in the next release.
*/
- @Deprecated
- public String operationName() {
+ String operationName() {
return name().toLowerCase(Locale.ROOT);
}
}

DELETE
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/InstrumentationVersion.java
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package io.opentelemetry.instrumentation.api;
-
-/**
- * This class will be removed.
- *
- * @deprecated This class will be removed.
- */
-@Deprecated
-public final class InstrumentationVersion {
- public static final String VERSION =
- InstrumentationVersion.class.getPackage().getImplementationVersion();
-
- private InstrumentationVersion() {}
-}

MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java
@@ -35,7 +35,6 @@ public abstract class Config {
@Nullable private static volatile Config instance = null;
/** Start building a new {@link Config} instance. */
- @SuppressWarnings("deprecation")
public static ConfigBuilder builder() {
return new ConfigBuilder();
}
@@ -189,49 +188,4 @@ public abstract class Config {
private String getRawProperty(String name, String defaultValue) {
return getAllProperties().getOrDefault(NamingConvention.DOT.normalize(name), defaultValue);
}
-
- /**
- * Returns {@code true} when instrumentation is enabled.
- *
- * @deprecated This method will be removed.
- */
- @Deprecated
- public boolean isInstrumentationEnabled(
- Iterable<String> instrumentationNames, boolean defaultEnabled) {
- return isInstrumentationPropertyEnabled(instrumentationNames, "enabled", defaultEnabled);
- }
-
- /**
- * Returns {@code true} when instrumentation is enabled.
- *
- * @deprecated This method will be removed.
- */
- @Deprecated
- public boolean isInstrumentationPropertyEnabled(
- Iterable<String> instrumentationNames, String suffix, boolean defaultEnabled) {
- // If default is enabled, we want to enable individually,
- // if default is disabled, we want to disable individually.
- boolean anyEnabled = defaultEnabled;
- for (String name : instrumentationNames) {
- String propertyName = "otel.instrumentation." + name + '.' + suffix;
- boolean enabled = getBoolean(propertyName, defaultEnabled);
-
- if (defaultEnabled) {
- anyEnabled &= enabled;
- } else {
- anyEnabled |= enabled;
- }
- }
- return anyEnabled;
- }
-
- /**
- * Returns {@code true} when agent runs in debug mode.
- *
- * @deprecated This method will be removed.
- */
- @Deprecated
- public boolean isAgentDebugEnabled() {
- return getBoolean("otel.javaagent.debug", false);
- }
}

MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ConfigBuilder.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ConfigBuilder.java
@@ -15,14 +15,8 @@ public final class ConfigBuilder {
private final Map<String, String> allProperties = new HashMap<>();
- /**
- * Constructs a new {@link ConfigBuilder}.
- *
- * @deprecated This method will be made package-private in the next release. Use {@link
- * Config#builder()} instead.
- */
- @Deprecated
- public ConfigBuilder() {}
+ /** Constructs a new {@link ConfigBuilder}. */
+ ConfigBuilder() {}
/** Adds a single property named to the config. */
public ConfigBuilder addProperty(String name, String value) {
@@ -30,26 +24,6 @@ public final class ConfigBuilder {
return this;
}
- /**
- * Adds all properties from the passed {@code properties} to the config.
- *
- * @deprecated Use {@link #addProperties(Properties)} instead.
- */
- @Deprecated
- public ConfigBuilder readProperties(Properties properties) {
- return addProperties(properties);
- }
-
- /**
- * Adds all properties from the passed {@code properties} to the config.
- *
- * @deprecated Use {@link #addProperties(Map)} instead.
- */
- @Deprecated
- public ConfigBuilder readProperties(Map<String, String> properties) {
- return addProperties(properties);
- }
-
/** Adds all properties from the passed {@code properties} to the config. */
public ConfigBuilder addProperties(Properties properties) {
for (String name : properties.stringPropertyNames()) {
@@ -63,18 +37,6 @@ public final class ConfigBuilder {
return fromConfigMap(properties, NamingConvention.DOT);
}
- /**
- * Adds environment variables, converted to Java property naming convention, to the config.
- *
- * <p>Environment variable names are lowercased, and the underscores are replaced by dots.
- *
- * @deprecated Use {@link #addEnvironmentVariables()} instead.
- */
- @Deprecated
- public ConfigBuilder readEnvironmentVariables() {
- return addEnvironmentVariables();
- }
-
/**
* Adds environment variables, converted to Java property naming convention, to the config.
*
@@ -84,16 +46,6 @@ public final class ConfigBuilder {
return fromConfigMap(System.getenv(), NamingConvention.ENV_VAR);
}
- /**
- * Adds system properties to the config.
- *
- * @deprecated Use {@link #addSystemProperties()} instead.
- */
- @Deprecated
- public ConfigBuilder readSystemProperties() {
- return addSystemProperties();
- }
-
/** Adds system properties to the config. */
public ConfigBuilder addSystemProperties() {
return addProperties(System.getProperties());

MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java
@@ -37,20 +37,6 @@ public interface AttributesExtractor<REQUEST, RESPONSE> {
@Nullable RESPONSE response,
@Nullable Throwable error);
- /**
- * Sets the {@code value} with the given {@code key} to the {@link AttributesBuilder} if {@code
- * value} is not {@code null}.
- *
- * @deprecated This method will be removed.
- */
- // TODO: remove after 1.13 release
- @Deprecated
- default <T> void set(AttributesBuilder attributes, AttributeKey<T> key, @Nullable T value) {
- if (value != null) {
- attributes.put(key, value);
- }
- }
-
/**
* Returns an {@link AttributesExtractor} implementation that always extracts the provided
* constant value.

MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java
@@ -61,37 +61,6 @@ public class Instrumenter<REQUEST, RESPONSE> {
return new InstrumenterBuilder<>(openTelemetry, instrumentationName, spanNameExtractor);
}
- /**
- * Returns a new {@link InstrumenterBuilder}.
- *
- * <p>The {@code instrumentationName} is the name of the instrumentation library, not the name of
- * the instrument*ed* library. The value passed in this parameter should uniquely identify the
- * instrumentation library so that during troubleshooting it's possible to pinpoint what tracer
- * produced problematic telemetry.
- *
- * <p>The {@code instrumentationVersion} is the version of the instrumentation library, not the
- * version of the instrument*ed* library.
- *
- * <p>In this project we use a convention to encode the minimum supported version of the
- * instrument*ed* library into the instrumentation name, for example {@code
- * io.opentelemetry.apache-httpclient-4.0}. This way, if there are different instrumentations for
- * different library versions it's easy to find out which instrumentations produced the telemetry
- * data.
- *
- * @deprecated Use the {@link InstrumenterBuilder#setInstrumentationVersion(String)} method
- * instead.
- */
- @Deprecated
- public static <REQUEST, RESPONSE> InstrumenterBuilder<REQUEST, RESPONSE> builder(
- OpenTelemetry openTelemetry,
- String instrumentationName,
- String instrumentationVersion,
- SpanNameExtractor<? super REQUEST> spanNameExtractor) {
- return Instrumenter.<REQUEST, RESPONSE>builder(
- openTelemetry, instrumentationName, spanNameExtractor)
- .setInstrumentationVersion(instrumentationVersion);
- }
-
private static final SupportabilityMetrics supportability = SupportabilityMetrics.instance();
private final String instrumentationName;

MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java
@@ -192,16 +192,6 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
return this;
}
- /**
- * Allows to disable the {@link Instrumenter}.
- *
- * @deprecated Use {@link #setEnabled(boolean)} instead.
- */
- @Deprecated
- public InstrumenterBuilder<REQUEST, RESPONSE> setDisabled(boolean disabled) {
- return setEnabled(!disabled);
- }
-
// visible for tests
/**
* Enables CLIENT nested span suppression based on the instrumentation type.

MODIFY
javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/instrumentation/InstrumentationModule.java
javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/instrumentation/InstrumentationModule.java
@@ -63,20 +63,6 @@ public abstract class InstrumentationModule implements Ordered {
this.instrumentationNames = unmodifiableSet(names);
}
- /**
- * Creates an instrumentation module.
- *
- * @see #InstrumentationModule(String, String...)
- * @deprecated Use {@link #InstrumentationModule(String, String...)} instead.
- */
- @Deprecated
- protected InstrumentationModule(List<String> instrumentationNames) {
- if (instrumentationNames.isEmpty()) {
- throw new IllegalArgumentException("InstrumentationModules must be named");
- }
- this.instrumentationNames = unmodifiableSet(new LinkedHashSet<>(instrumentationNames));
- }
-
/**
* Returns all instrumentation names assigned to this module. See {@link
* #InstrumentationModule(String, String...)} for more details about instrumentation names.
@@ -93,16 +79,6 @@ public abstract class InstrumentationModule implements Ordered {
return instrumentationNames.iterator().next();
}
- /**
- * Returns true if this instrumentation module should be installed.
- *
- * @deprecated This method will be removed.
- */
- @Deprecated
- public final boolean isEnabled() {
- return Config.get().isInstrumentationEnabled(instrumentationNames, defaultEnabled());
- }
-
/**
* Allows instrumentation modules to disable themselves by default, or to additionally disable
* themselves on some other condition.

Remove deprecated code from instrumentation-api, extension-api (#5883)