Remove deprecated methods from instrumentation-api and library instrumentations (#5575)

This commit is contained in:
Mateusz Rzeszutek 2022-03-15 01:33:48 +01:00 committed by GitHub
parent 98759f4c01
commit b0d5fc6b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 155 additions and 714 deletions

View File

@ -5,8 +5,6 @@
package io.opentelemetry.instrumentation.api.config;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Objects.requireNonNull;
import com.google.auto.value.AutoValue;
@ -92,18 +90,6 @@ public abstract class Config {
return getRawProperty(name, defaultValue);
}
/**
* Returns a boolean-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*
* @deprecated Use the {@link #getBoolean(String, boolean)} variant instead.
*/
@Deprecated
@Nullable
public Boolean getBoolean(String name) {
return getTypedProperty(name, ConfigValueParsers::parseBoolean);
}
/**
* Returns a boolean-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured.
@ -112,101 +98,33 @@ public abstract class Config {
return safeGetTypedProperty(name, ConfigValueParsers::parseBoolean, defaultValue);
}
/**
* Returns a integer-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*
* @throws ConfigParsingException if the property is not a valid integer.
* @deprecated Use the {@link #getInt(String, int)} variant instead.
*/
@Deprecated
@Nullable
public Integer getInt(String name) {
return getTypedProperty(name, ConfigValueParsers::parseInt);
}
/**
* Returns a integer-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed. This is the safe variant of
* {@link #getInt(String)}.
* {@code name} has not been configured or when parsing has failed.
*/
public int getInt(String name, int defaultValue) {
return safeGetTypedProperty(name, ConfigValueParsers::parseInt, defaultValue);
}
/**
* Returns a long-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*
* @throws ConfigParsingException if the property is not a valid long.
* @deprecated Use the {@link #getLong(String, long)} variant instead.
*/
@Deprecated
@Nullable
public Long getLong(String name) {
return getTypedProperty(name, ConfigValueParsers::parseLong);
}
/**
* Returns a long-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed. This is the safe variant of
* {@link #getLong(String)}.
* {@code name} has not been configured or when parsing has failed.
*/
public long getLong(String name, long defaultValue) {
return safeGetTypedProperty(name, ConfigValueParsers::parseLong, defaultValue);
}
/**
* Returns a double-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*
* @throws ConfigParsingException if the property is not a valid long.
* @deprecated Use the {@link #getDouble(String, double)} variant instead.
*/
@Deprecated
@Nullable
public Double getDouble(String name) {
return getTypedProperty(name, ConfigValueParsers::parseDouble);
}
/**
* Returns a double-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed. This is the safe variant of
* {@link #getDouble(String)}.
* {@code name} has not been configured or when parsing has failed.
*/
public double getDouble(String name, double defaultValue) {
return safeGetTypedProperty(name, ConfigValueParsers::parseDouble, defaultValue);
}
/**
* Returns a duration-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*
* <p>Durations can be of the form "{number}{unit}", where unit is one of:
*
* <ul>
* <li>ms
* <li>s
* <li>m
* <li>h
* <li>d
* </ul>
*
* <p>If no unit is specified, milliseconds is the assumed duration unit.
*
* @throws ConfigParsingException if the property is not a valid long.
* @deprecated Use the {@link #getDuration(String, Duration)} variant instead.
*/
@Deprecated
@Nullable
public Duration getDuration(String name) {
return getTypedProperty(name, ConfigValueParsers::parseDuration);
}
/**
* Returns a duration-valued configuration property or {@code defaultValue} if a property with
* name {@code name} has not been configured or when parsing has failed. This is the safe variant
* of {@link #getDuration(String)}.
* name {@code name} has not been configured or when parsing has failed.
*
* <p>Durations can be of the form "{number}{unit}", where unit is one of:
*
@ -224,19 +142,6 @@ public abstract class Config {
return safeGetTypedProperty(name, ConfigValueParsers::parseDuration, defaultValue);
}
/**
* Returns a list-valued configuration property or an empty list if a property with name {@code
* name} has not been configured. The format of the original value must be comma-separated, e.g.
* {@code one,two,three}.
*
* @deprecated Use the {@link #getList(String, List)} variant instead.
*/
@Deprecated
public List<String> getList(String name) {
List<String> list = getTypedProperty(name, ConfigValueParsers::parseList);
return list == null ? emptyList() : list;
}
/**
* Returns a list-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured. The format of the original value must be comma-separated,
@ -246,26 +151,11 @@ public abstract class Config {
return safeGetTypedProperty(name, ConfigValueParsers::parseList, defaultValue);
}
/**
* Returns a map-valued configuration property or an empty map if a property with name {@code
* name} has not been configured. The format of the original value must be comma-separated for
* each key, with an '=' separating the key and value, e.g. {@code
* key=value,anotherKey=anotherValue}.
*
* @throws ConfigParsingException if the property is not a valid long.
* @deprecated Use the {@link #getMap(String, Map)} variant instead.
*/
@Deprecated
public Map<String, String> getMap(String name) {
Map<String, String> map = getTypedProperty(name, ConfigValueParsers::parseMap);
return map == null ? emptyMap() : map;
}
/**
* Returns a map-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed. This is the safe variant of
* {@link #getMap(String)}. The format of the original value must be comma-separated for each key,
* with an '=' separating the key and value, e.g. {@code key=value,anotherKey=anotherValue}.
* {@code name} has not been configured or when parsing has failed. The format of the original
* value must be comma-separated for each key, with an '=' separating the key and value, e.g.
* {@code key=value,anotherKey=anotherValue}.
*/
public Map<String, String> getMap(String name, Map<String, String> defaultValue) {
return safeGetTypedProperty(name, ConfigValueParsers::parseMap, defaultValue);

View File

@ -5,14 +5,10 @@
package io.opentelemetry.instrumentation.api.config;
public class ConfigParsingException extends RuntimeException {
class ConfigParsingException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ConfigParsingException(String message) {
ConfigParsingException(String message) {
super(message);
}
public ConfigParsingException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -31,50 +31,18 @@ public interface AttributesExtractor<REQUEST, RESPONSE> {
* Extracts attributes from the {@link Context} and the {@link REQUEST} into the {@link
* AttributesBuilder} at the beginning of a request.
*/
default void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
onStart(attributes, request);
}
/**
* Extracts attributes from the {@link REQUEST} into the {@link AttributesBuilder} at the
* beginning of a request.
*
* @deprecated Use {@link #onStart(AttributesBuilder, Context, Object)} instead.
*/
@Deprecated
default void onStart(AttributesBuilder attributes, REQUEST request) {
throw new UnsupportedOperationException(
"This method variant is deprecated and will be removed in the next minor release.");
}
void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request);
/**
* Extracts attributes from the {@link Context}, the {@link REQUEST} and either {@link RESPONSE}
* or {@code error} into the {@link AttributesBuilder} at the end of a request.
*/
default void onEnd(
void onEnd(
AttributesBuilder attributes,
Context context,
REQUEST request,
@Nullable RESPONSE response,
@Nullable Throwable error) {
onEnd(attributes, request, response, error);
}
/**
* Extracts attributes from the {@link REQUEST} and either {@link RESPONSE} or {@code error} into
* the {@link AttributesBuilder} at the end of a request.
*
* @deprecated Use {@link #onEnd(AttributesBuilder, Context, Object, Object, Throwable)} instead.
*/
@Deprecated
default void onEnd(
AttributesBuilder attributes,
REQUEST request,
@Nullable RESPONSE response,
@Nullable Throwable error) {
throw new UnsupportedOperationException(
"This method variant is deprecated and will be removed in the next minor release.");
}
@Nullable Throwable error);
/**
* Sets the {@code value} with the given {@code key} to the {@link AttributesBuilder} if {@code

View File

@ -1,102 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.api.instrumenter.http;
import static java.util.Collections.emptyList;
import com.google.auto.value.AutoValue;
import io.opentelemetry.instrumentation.api.config.Config;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
/**
* Represents the configuration that specifies which HTTP request and response headers should be
* captured as span attributes as described in <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers">HTTP
* semantic conventions</a>.
*
* <p>The HTTP request header values will be captured under the {@code http.request.header.<name>}
* attribute key. The HTTP response header values will be captured under the {@code
* http.response.header.<name>} attribute key. The {@code <name>} part in the attribute key is the
* normalized header name: lowercase, with dashes replaced by underscores.
*
* @deprecated This class should no longer be used directly. Use the {@link
* HttpClientAttributesExtractorBuilder#setCapturedRequestHeaders(List)}, {@link
* HttpClientAttributesExtractorBuilder#setCapturedResponseHeaders(List)}, {@link
* HttpServerAttributesExtractorBuilder#setCapturedRequestHeaders(List)} and {@link
* HttpServerAttributesExtractorBuilder#setCapturedResponseHeaders(List)} methods instead.
*/
@Deprecated
@AutoValue
@AutoValue.CopyAnnotations
public abstract class CapturedHttpHeaders {
private static final CapturedHttpHeaders EMPTY = create(emptyList(), emptyList());
/** Returns a configuration that does not capture any HTTP headers as span attributes. */
public static CapturedHttpHeaders empty() {
return EMPTY;
}
private static final String CLIENT_REQUEST_PROPERTY =
"otel.instrumentation.http.capture-headers.client.request";
private static final String CLIENT_RESPONSE_PROPERTY =
"otel.instrumentation.http.capture-headers.client.response";
/**
* Returns a configuration that captures HTTP client request and response headers as configured in
* the received {@code config}.
*/
public static CapturedHttpHeaders client(Config config) {
// fall back to the experimental properties if the stable one isn't supplied
return CapturedHttpHeaders.create(
config.getList(CLIENT_REQUEST_PROPERTY, emptyList()),
config.getList(CLIENT_RESPONSE_PROPERTY, emptyList()));
}
private static final String SERVER_REQUEST_PROPERTY =
"otel.instrumentation.http.capture-headers.server.request";
private static final String SERVER_RESPONSE_PROPERTY =
"otel.instrumentation.http.capture-headers.server.response";
/**
* Returns a configuration that captures HTTP server request and response headers as configured in
* the received {@code config}.
*/
public static CapturedHttpHeaders server(Config config) {
// fall back to the experimental properties if the stable one isn't supplied
return CapturedHttpHeaders.create(
config.getList(SERVER_REQUEST_PROPERTY, emptyList()),
config.getList(SERVER_RESPONSE_PROPERTY, emptyList()));
}
/**
* Returns a configuration that captures chosen HTTP request and response headers.
*
* @param capturedRequestHeaders A list of HTTP request header names that are to be captured as
* span attributes.
* @param capturedResponseHeaders A list of HTTP response header names that are to be captured as
* span attributes.
*/
public static CapturedHttpHeaders create(
List<String> capturedRequestHeaders, List<String> capturedResponseHeaders) {
return new AutoValue_CapturedHttpHeaders(
lowercase(capturedRequestHeaders), lowercase(capturedResponseHeaders));
}
private static List<String> lowercase(List<String> names) {
return names.stream().map(s -> s.toLowerCase(Locale.ROOT)).collect(Collectors.toList());
}
/** Returns the list of HTTP request header names that are to be captured as span attributes. */
public abstract List<String> requestHeaders();
/** Returns the list of HTTP response header names that are to be captured as span attributes. */
public abstract List<String> responseHeaders();
CapturedHttpHeaders() {}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.api.instrumenter.http;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.api.config.Config;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
final class CapturedHttpHeadersUtil {
private static final String CLIENT_REQUEST_PROPERTY =
"otel.instrumentation.http.capture-headers.client.request";
private static final String CLIENT_RESPONSE_PROPERTY =
"otel.instrumentation.http.capture-headers.client.response";
private static final String SERVER_REQUEST_PROPERTY =
"otel.instrumentation.http.capture-headers.server.request";
private static final String SERVER_RESPONSE_PROPERTY =
"otel.instrumentation.http.capture-headers.server.response";
static final List<String> clientRequestHeaders;
static final List<String> clientResponseHeaders;
static final List<String> serverRequestHeaders;
static final List<String> serverResponseHeaders;
static {
Config config = Config.get();
clientRequestHeaders = config.getList(CLIENT_REQUEST_PROPERTY, emptyList());
clientResponseHeaders = config.getList(CLIENT_RESPONSE_PROPERTY, emptyList());
serverRequestHeaders = config.getList(SERVER_REQUEST_PROPERTY, emptyList());
serverResponseHeaders = config.getList(SERVER_RESPONSE_PROPERTY, emptyList());
}
// these are naturally bounded because they only store keys listed in
// otel.instrumentation.http.capture-headers.server.request and
// otel.instrumentation.http.capture-headers.server.response
private static final ConcurrentMap<String, AttributeKey<List<String>>> requestKeysCache =
new ConcurrentHashMap<>();
private static final ConcurrentMap<String, AttributeKey<List<String>>> responseKeysCache =
new ConcurrentHashMap<>();
static List<String> lowercase(List<String> names) {
return unmodifiableList(
names.stream().map(s -> s.toLowerCase(Locale.ROOT)).collect(Collectors.toList()));
}
static AttributeKey<List<String>> requestAttributeKey(String headerName) {
return requestKeysCache.computeIfAbsent(headerName, n -> createKey("request", n));
}
static AttributeKey<List<String>> responseAttributeKey(String headerName) {
return responseKeysCache.computeIfAbsent(headerName, n -> createKey("response", n));
}
private static AttributeKey<List<String>> createKey(String type, String headerName) {
// headerName is always lowercase, see CapturedHttpHeaders
String key = "http." + type + ".header." + headerName.replace('-', '_');
return AttributeKey.stringArrayKey(key);
}
private CapturedHttpHeadersUtil() {}
}

View File

@ -8,6 +8,7 @@ package io.opentelemetry.instrumentation.api.instrumenter.http;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.List;
import javax.annotation.Nullable;
/**
@ -19,7 +20,6 @@ import javax.annotation.Nullable;
* return {@code null} from the protected attribute methods, but implement as many as possible for
* best compliance with the OpenTelemetry specification.
*/
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
public final class HttpClientAttributesExtractor<REQUEST, RESPONSE>
extends HttpCommonAttributesExtractor<
REQUEST, RESPONSE, HttpClientAttributesGetter<REQUEST, RESPONSE>> {
@ -30,20 +30,6 @@ public final class HttpClientAttributesExtractor<REQUEST, RESPONSE>
return builder(getter).build();
}
/**
* Creates the HTTP client attributes extractor.
*
* @param capturedHttpHeaders A configuration object specifying which HTTP request and response
* headers should be captured as span attributes.
* @deprecated Use {@link #builder(HttpClientAttributesGetter)} instead.
*/
@Deprecated
public static <REQUEST, RESPONSE> HttpClientAttributesExtractor<REQUEST, RESPONSE> create(
HttpClientAttributesGetter<REQUEST, RESPONSE> getter,
CapturedHttpHeaders capturedHttpHeaders) {
return builder(getter).captureHttpHeaders(capturedHttpHeaders).build();
}
/**
* Returns a new {@link HttpClientAttributesExtractorBuilder} that can be used to configure the
* HTTP client attributes extractor.
@ -55,8 +41,9 @@ public final class HttpClientAttributesExtractor<REQUEST, RESPONSE>
HttpClientAttributesExtractor(
HttpClientAttributesGetter<REQUEST, RESPONSE> getter,
CapturedHttpHeaders capturedHttpHeaders) {
super(getter, capturedHttpHeaders);
List<String> capturedRequestHeaders,
List<String> responseHeaders) {
super(getter, capturedRequestHeaders, responseHeaders);
}
@Override

View File

@ -5,56 +5,51 @@
package io.opentelemetry.instrumentation.api.instrumenter.http;
import io.opentelemetry.instrumentation.api.config.Config;
import java.util.List;
/** A builder of {@link HttpClientAttributesExtractor}. */
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
public final class HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> {
final HttpClientAttributesGetter<REQUEST, RESPONSE> getter;
CapturedHttpHeaders capturedHttpHeaders = CapturedHttpHeaders.client(Config.get());
List<String> capturedRequestHeaders = CapturedHttpHeadersUtil.clientRequestHeaders;
List<String> capturedResponseHeaders = CapturedHttpHeadersUtil.clientResponseHeaders;
HttpClientAttributesExtractorBuilder(HttpClientAttributesGetter<REQUEST, RESPONSE> getter) {
this.getter = getter;
}
/**
* Configures the HTTP headers that will be captured as span attributes.
* Configures the HTTP request headers that will be captured as span attributes as described in <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers">HTTP
* semantic conventions</a>.
*
* @param capturedHttpHeaders A configuration object specifying which HTTP request and response
* headers should be captured as span attributes.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> captureHttpHeaders(
CapturedHttpHeaders capturedHttpHeaders) {
this.capturedHttpHeaders = capturedHttpHeaders;
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
* <p>The HTTP request header values will be captured under the {@code http.request.header.<name>}
* attribute key. The {@code <name>} part in the attribute key is the normalized header name:
* lowercase, with dashes replaced by underscores.
*
* @param requestHeaders A list of HTTP header names.
*/
public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedRequestHeaders(
List<String> requestHeaders) {
this.capturedHttpHeaders =
CapturedHttpHeaders.create(requestHeaders, capturedHttpHeaders.responseHeaders());
this.capturedRequestHeaders = requestHeaders;
return this;
}
/**
* Configures the HTTP response headers that will be captured as span attributes.
* Configures the HTTP response headers that will be captured as span attributes as described in
* <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers">HTTP
* semantic conventions</a>.
*
* <p>The HTTP response header values will be captured under the {@code
* http.response.header.<name>} attribute key. The {@code <name>} part in the attribute key is the
* normalized header name: lowercase, with dashes replaced by underscores.
*
* @param responseHeaders A list of HTTP header names.
*/
public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedResponseHeaders(
List<String> responseHeaders) {
this.capturedHttpHeaders =
CapturedHttpHeaders.create(capturedHttpHeaders.requestHeaders(), responseHeaders);
this.capturedResponseHeaders = responseHeaders;
return this;
}
@ -63,6 +58,7 @@ public final class HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> {
* HttpClientAttributesExtractorBuilder}.
*/
public HttpClientAttributesExtractor<REQUEST, RESPONSE> build() {
return new HttpClientAttributesExtractor<>(getter, capturedHttpHeaders);
return new HttpClientAttributesExtractor<>(
getter, capturedRequestHeaders, capturedResponseHeaders);
}
}

View File

@ -5,8 +5,9 @@
package io.opentelemetry.instrumentation.api.instrumenter.http;
import static io.opentelemetry.instrumentation.api.instrumenter.http.HttpHeaderAttributes.requestAttributeKey;
import static io.opentelemetry.instrumentation.api.instrumenter.http.HttpHeaderAttributes.responseAttributeKey;
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.lowercase;
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.requestAttributeKey;
import static io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeadersUtil.responseAttributeKey;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
@ -20,17 +21,19 @@ import javax.annotation.Nullable;
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#common-attributes">HTTP
* attributes</a> that are common to client and server instrumentations.
*/
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
abstract class HttpCommonAttributesExtractor<
REQUEST, RESPONSE, GETTER extends HttpCommonAttributesGetter<REQUEST, RESPONSE>>
implements AttributesExtractor<REQUEST, RESPONSE> {
final GETTER getter;
private final CapturedHttpHeaders capturedHttpHeaders;
private final List<String> capturedRequestHeaders;
private final List<String> capturedResponseHeaders;
HttpCommonAttributesExtractor(GETTER getter, CapturedHttpHeaders capturedHttpHeaders) {
HttpCommonAttributesExtractor(
GETTER getter, List<String> capturedRequestHeaders, List<String> capturedResponseHeaders) {
this.getter = getter;
this.capturedHttpHeaders = capturedHttpHeaders;
this.capturedRequestHeaders = lowercase(capturedRequestHeaders);
this.capturedResponseHeaders = lowercase(capturedResponseHeaders);
}
@Override
@ -38,7 +41,7 @@ abstract class HttpCommonAttributesExtractor<
set(attributes, SemanticAttributes.HTTP_METHOD, getter.method(request));
set(attributes, SemanticAttributes.HTTP_USER_AGENT, userAgent(request));
for (String name : capturedHttpHeaders.requestHeaders()) {
for (String name : capturedRequestHeaders) {
List<String> values = getter.requestHeader(request, name);
if (!values.isEmpty()) {
set(attributes, requestAttributeKey(name), values);
@ -77,7 +80,7 @@ abstract class HttpCommonAttributesExtractor<
SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,
getter.responseContentLengthUncompressed(request, response));
for (String name : capturedHttpHeaders.responseHeaders()) {
for (String name : capturedResponseHeaders) {
List<String> values = getter.responseHeader(request, response, name);
if (!values.isEmpty()) {
set(attributes, responseAttributeKey(name), values);

View File

@ -1,38 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.api.instrumenter.http;
import io.opentelemetry.api.common.AttributeKey;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
final class HttpHeaderAttributes {
// these are naturally bounded because they only store keys listed in
// otel.instrumentation.http.capture-headers.server.request and
// otel.instrumentation.http.capture-headers.server.response
private static final ConcurrentMap<String, AttributeKey<List<String>>> requestKeysCache =
new ConcurrentHashMap<>();
private static final ConcurrentMap<String, AttributeKey<List<String>>> responseKeysCache =
new ConcurrentHashMap<>();
static AttributeKey<List<String>> requestAttributeKey(String headerName) {
return requestKeysCache.computeIfAbsent(headerName, n -> createKey("request", n));
}
static AttributeKey<List<String>> responseAttributeKey(String headerName) {
return responseKeysCache.computeIfAbsent(headerName, n -> createKey("response", n));
}
private static AttributeKey<List<String>> createKey(String type, String headerName) {
// headerName is always lowercase, see CapturedHttpHeaders
String key = "http." + type + ".header." + headerName.replace('-', '_');
return AttributeKey.stringArrayKey(key);
}
private HttpHeaderAttributes() {}
}

View File

@ -13,6 +13,7 @@ import static io.opentelemetry.instrumentation.api.instrumenter.http.ForwardedHe
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nullable;
@ -25,7 +26,6 @@ import javax.annotation.Nullable;
* return {@code null} from the protected attribute methods, but implement as many as possible for
* best compliance with the OpenTelemetry specification.
*/
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
extends HttpCommonAttributesExtractor<
REQUEST, RESPONSE, HttpServerAttributesGetter<REQUEST, RESPONSE>> {
@ -36,20 +36,6 @@ public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
return builder(getter).build();
}
/**
* Creates the HTTP server attributes extractor.
*
* @param capturedHttpHeaders A configuration object specifying which HTTP request and response
* headers should be captured as span attributes.
* @deprecated Use {@link #builder(HttpServerAttributesGetter)} instead.
*/
@Deprecated
public static <REQUEST, RESPONSE> HttpServerAttributesExtractor<REQUEST, RESPONSE> create(
HttpServerAttributesGetter<REQUEST, RESPONSE> getter,
CapturedHttpHeaders capturedHttpHeaders) {
return builder(getter).captureHttpHeaders(capturedHttpHeaders).build();
}
/**
* Returns a new {@link HttpServerAttributesExtractorBuilder} that can be used to configure the
* HTTP client attributes extractor.
@ -63,16 +49,18 @@ public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
HttpServerAttributesExtractor(
HttpServerAttributesGetter<REQUEST, RESPONSE> getter,
CapturedHttpHeaders capturedHttpHeaders) {
this(getter, capturedHttpHeaders, HttpRouteHolder::getRoute);
List<String> capturedRequestHeaders,
List<String> capturedResponseHeaders) {
this(getter, capturedRequestHeaders, capturedResponseHeaders, HttpRouteHolder::getRoute);
}
// visible for tests
HttpServerAttributesExtractor(
HttpServerAttributesGetter<REQUEST, RESPONSE> getter,
CapturedHttpHeaders capturedHttpHeaders,
List<String> capturedRequestHeaders,
List<String> responseHeaders,
Function<Context, String> httpRouteHolderGetter) {
super(getter, capturedHttpHeaders);
super(getter, capturedRequestHeaders, responseHeaders);
this.httpRouteHolderGetter = httpRouteHolderGetter;
}

View File

@ -5,56 +5,51 @@
package io.opentelemetry.instrumentation.api.instrumenter.http;
import io.opentelemetry.instrumentation.api.config.Config;
import java.util.List;
/** A builder of {@link HttpServerAttributesExtractor}. */
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
public final class HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> {
final HttpServerAttributesGetter<REQUEST, RESPONSE> getter;
CapturedHttpHeaders capturedHttpHeaders = CapturedHttpHeaders.server(Config.get());
List<String> capturedRequestHeaders = CapturedHttpHeadersUtil.serverRequestHeaders;
List<String> capturedResponseHeaders = CapturedHttpHeadersUtil.serverResponseHeaders;
HttpServerAttributesExtractorBuilder(HttpServerAttributesGetter<REQUEST, RESPONSE> getter) {
this.getter = getter;
}
/**
* Configures the HTTP headers that will be captured as span attributes.
* Configures the HTTP request headers that will be captured as span attributes as described in <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers">HTTP
* semantic conventions</a>.
*
* @param capturedHttpHeaders A configuration object specifying which HTTP request and response
* headers should be captured as span attributes.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> captureHttpHeaders(
CapturedHttpHeaders capturedHttpHeaders) {
this.capturedHttpHeaders = capturedHttpHeaders;
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
* <p>The HTTP request header values will be captured under the {@code http.request.header.<name>}
* attribute key. The {@code <name>} part in the attribute key is the normalized header name:
* lowercase, with dashes replaced by underscores.
*
* @param requestHeaders A list of HTTP header names.
*/
public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedRequestHeaders(
List<String> requestHeaders) {
this.capturedHttpHeaders =
CapturedHttpHeaders.create(requestHeaders, capturedHttpHeaders.responseHeaders());
this.capturedRequestHeaders = requestHeaders;
return this;
}
/**
* Configures the HTTP response headers that will be captured as span attributes.
* Configures the HTTP response headers that will be captured as span attributes as described in
* <a
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers">HTTP
* semantic conventions</a>.
*
* <p>The HTTP response header values will be captured under the {@code
* http.response.header.<name>} attribute key. The {@code <name>} part in the attribute key is the
* normalized header name: lowercase, with dashes replaced by underscores.
*
* @param responseHeaders A list of HTTP header names.
*/
public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedResponseHeaders(
List<String> responseHeaders) {
this.capturedHttpHeaders =
CapturedHttpHeaders.create(capturedHttpHeaders.requestHeaders(), responseHeaders);
this.capturedResponseHeaders = responseHeaders;
return this;
}
@ -63,6 +58,7 @@ public final class HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> {
* HttpServerAttributesExtractorBuilder}.
*/
public HttpServerAttributesExtractor<REQUEST, RESPONSE> build() {
return new HttpServerAttributesExtractor<>(getter, capturedHttpHeaders);
return new HttpServerAttributesExtractor<>(
getter, capturedRequestHeaders, capturedResponseHeaders);
}
}

View File

@ -17,18 +17,6 @@ import javax.annotation.Nullable;
*/
public final class ServerSpan {
/**
* Returns true when a {@link SpanKind#SERVER} span is present in the passed {@code context}.
*
* @deprecated This method should not be used directly; it's functionality is encapsulated inside
* the {@linkplain io.opentelemetry.instrumentation.api.instrumenter.Instrumenter Instrumenter
* API}.
*/
@Deprecated
public static boolean exists(Context context) {
return fromContextOrNull(context) != null;
}
/**
* Returns span of type {@link SpanKind#SERVER} from the given context or {@code null} if not
* found.
@ -38,17 +26,5 @@ public final class ServerSpan {
return SpanKey.SERVER.fromContextOrNull(context);
}
/**
* Marks the span as the server span in the passed context.
*
* @deprecated This method should not be used directly; it's functionality is encapsulated inside
* the {@linkplain io.opentelemetry.instrumentation.api.instrumenter.Instrumenter Instrumenter
* API}.
*/
@Deprecated
public static Context with(Context context, Span serverSpan) {
return SpanKey.SERVER.storeInContext(context, serverSpan);
}
private ServerSpan() {}
}

View File

@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.api.config;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
@ -14,7 +15,6 @@ import static org.assertj.core.api.Assertions.entry;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration;
@ -29,7 +29,7 @@ import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
// suppress duration unit check, e.g. ofMillis(5000) -> ofSeconds(5)
@SuppressWarnings({"CanonicalDuration", "deprecation"})
@SuppressWarnings({"CanonicalDuration"})
class ConfigTest {
@Test
void shouldGetString() {
@ -45,9 +45,7 @@ class ConfigTest {
void shouldGetBoolean() {
Config config = Config.builder().addProperty("prop.boolean", "true").build();
assertTrue(config.getBoolean("prop.boolean"));
assertTrue(config.getBoolean("prop.boolean", false));
assertNull(config.getBoolean("prop.missing"));
assertFalse(config.getBoolean("prop.missing", false));
}
@ -56,39 +54,21 @@ class ConfigTest {
Config config =
Config.builder().addProperty("prop.int", "12").addProperty("prop.wrong", "twelve").build();
assertEquals(12, config.getInt("prop.int"));
assertEquals(12, config.getInt("prop.int", 1000));
assertEquals(1000, config.getInt("prop.wrong", 1000));
assertNull(config.getInt("prop.missing"));
assertEquals(1000, config.getInt("prop.missing", 1000));
}
@Test
void shouldFailOnInvalidInt() {
Config config = Config.builder().addProperty("prop.wrong", "twelve").build();
assertThrows(ConfigParsingException.class, () -> config.getInt("prop.wrong"));
}
@Test
void shouldGetLong() {
Config config =
Config.builder().addProperty("prop.long", "12").addProperty("prop.wrong", "twelve").build();
assertEquals(12, config.getLong("prop.long"));
assertEquals(12, config.getLong("prop.long", 1000));
assertEquals(1000, config.getLong("prop.wrong", 1000));
assertNull(config.getLong("prop.missing"));
assertEquals(1000, config.getLong("prop.missing", 1000));
}
@Test
void shouldFailOnInvalidLong() {
Config config = Config.builder().addProperty("prop.wrong", "twelve").build();
assertThrows(ConfigParsingException.class, () -> config.getLong("prop.wrong"));
}
@Test
void shouldGetDouble() {
Config config =
@ -97,20 +77,11 @@ class ConfigTest {
.addProperty("prop.wrong", "twelve point something")
.build();
assertEquals(12.345, config.getDouble("prop.double"));
assertEquals(12.345, config.getDouble("prop.double", 99.99));
assertEquals(99.99, config.getDouble("prop.wrong", 99.99));
assertNull(config.getDouble("prop.missing"));
assertEquals(99.99, config.getDouble("prop.missing", 99.99));
}
@Test
void shouldFailOnInvalidDouble() {
Config config = Config.builder().addProperty("prop.wrong", "twelve point something").build();
assertThrows(ConfigParsingException.class, () -> config.getDouble("prop.wrong"));
}
@Test
void shouldGetDuration_defaultUnit() {
Config config =
@ -119,46 +90,35 @@ class ConfigTest {
.addProperty("prop.wrong", "hundred days")
.build();
assertEquals(Duration.ofMillis(5000), config.getDuration("prop.duration"));
assertEquals(Duration.ofMillis(5000), config.getDuration("prop.duration", Duration.ZERO));
assertEquals(Duration.ZERO, config.getDuration("prop.wrong", Duration.ZERO));
assertNull(config.getDuration("prop.missing"));
assertEquals(Duration.ZERO, config.getDuration("prop.missing", Duration.ZERO));
}
@Test
void shouldFailOnInvalidDuration() {
Config config = Config.builder().addProperty("prop.wrong", "hundred days").build();
assertThrows(ConfigParsingException.class, () -> config.getDuration("prop.wrong"));
}
@Test
void shouldGetDuration_variousUnits() {
Config config = Config.builder().addProperty("prop.duration", "100ms").build();
assertEquals(Duration.ofMillis(100), config.getDuration("prop.duration"));
assertEquals(Duration.ofMillis(100), config.getDuration("prop.duration", Duration.ZERO));
config = Config.builder().addProperty("prop.duration", "100s").build();
assertEquals(Duration.ofSeconds(100), config.getDuration("prop.duration"));
assertEquals(Duration.ofSeconds(100), config.getDuration("prop.duration", Duration.ZERO));
config = Config.builder().addProperty("prop.duration", "100m").build();
assertEquals(Duration.ofMinutes(100), config.getDuration("prop.duration"));
assertEquals(Duration.ofMinutes(100), config.getDuration("prop.duration", Duration.ZERO));
config = Config.builder().addProperty("prop.duration", "100h").build();
assertEquals(Duration.ofHours(100), config.getDuration("prop.duration"));
assertEquals(Duration.ofHours(100), config.getDuration("prop.duration", Duration.ZERO));
config = Config.builder().addProperty("prop.duration", "100d").build();
assertEquals(Duration.ofDays(100), config.getDuration("prop.duration"));
assertEquals(Duration.ofDays(100), config.getDuration("prop.duration", Duration.ZERO));
}
@Test
void shouldGetList() {
Config config = Config.builder().addProperty("prop.list", "one, two ,three").build();
assertEquals(asList("one", "two", "three"), config.getList("prop.list"));
assertEquals(
asList("one", "two", "three"), config.getList("prop.list", singletonList("default")));
assertTrue(config.getList("prop.missing").isEmpty());
assertEquals(
singletonList("default"), config.getList("prop.missing", singletonList("default")));
}
@ -172,22 +132,13 @@ class ConfigTest {
.addProperty("prop.trailing", "one=1,")
.build();
assertThat(config.getMap("prop.map")).containsOnly(entry("one", "1"), entry("two", "2"));
assertThat(config.getMap("prop.map", singletonMap("three", "3")))
.containsOnly(entry("one", "1"), entry("two", "2"));
assertThat(config.getMap("prop.wrong", singletonMap("three", "3")))
.containsOnly(entry("three", "3"));
assertThat(config.getMap("prop.missing")).isEmpty();
assertThat(config.getMap("prop.missing", singletonMap("three", "3")))
.containsOnly(entry("three", "3"));
assertThat(config.getMap("prop.trailing")).containsOnly(entry("one", "1"));
}
@Test
void shouldFailOnInvalidMap() {
Config config = Config.builder().addProperty("prop.wrong", "one=1, but not two!").build();
assertThrows(ConfigParsingException.class, () -> config.getMap("prop.wrong"));
assertThat(config.getMap("prop.trailing", emptyMap())).containsOnly(entry("one", "1"));
}
@ParameterizedTest

View File

@ -22,7 +22,6 @@ import java.util.Map;
import java.util.function.Function;
import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation") // suppress CapturedHttpHeaders deprecation
class HttpServerAttributesExtractorTest {
static class TestHttpServerAttributesExtractor
@ -132,8 +131,8 @@ class HttpServerAttributesExtractorTest {
HttpServerAttributesExtractor<Map<String, String>, Map<String, String>> extractor =
new HttpServerAttributesExtractor<>(
new TestHttpServerAttributesExtractor(),
CapturedHttpHeaders.create(
singletonList("Custom-Request-Header"), singletonList("Custom-Response-Header")),
singletonList("Custom-Request-Header"),
singletonList("Custom-Response-Header"),
routeFromContext);
AttributesBuilder attributes = Attributes.builder();

View File

@ -46,24 +46,6 @@ public final class ApacheHttpClientTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public ApacheHttpClientTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -84,24 +84,6 @@ public final class ArmeriaTracingBuilder {
return this;
}
/**
* Configure the HTTP client instrumentation to capture chosen HTTP request and response headers
* as span attributes.
*
* @param capturedHttpClientHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedClientRequestHeaders(List)} and {@link
* #setCapturedClientResponseHeaders(List)} instead.
*/
@Deprecated
public ArmeriaTracingBuilder captureHttpClientHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpClientHeaders) {
httpClientAttributesExtractorBuilder.captureHttpHeaders(capturedHttpClientHeaders);
return this;
}
/**
* Configures the HTTP client request headers that will be captured as span attributes.
*
@ -122,24 +104,6 @@ public final class ArmeriaTracingBuilder {
return this;
}
/**
* Configure the HTTP server instrumentation to capture chosen HTTP request and response headers
* as span attributes.
*
* @param capturedHttpServerHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedServerRequestHeaders(List)} and {@link
* #setCapturedServerResponseHeaders(List)} instead.
*/
@Deprecated
public ArmeriaTracingBuilder captureHttpServerHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpServerHeaders) {
httpServerAttributesExtractorBuilder.captureHttpHeaders(capturedHttpServerHeaders);
return this;
}
/**
* Configures the HTTP server request headers that will be captured as span attributes.
*

View File

@ -45,26 +45,6 @@ public final class JettyClientTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public JettyClientTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
instrumenterBuilder
.setCapturedRequestHeaders(capturedHttpHeaders.requestHeaders())
.setCapturedResponseHeaders(capturedHttpHeaders.responseHeaders());
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -52,11 +52,6 @@ class KtorServerTracing private constructor(
additionalExtractors.add(extractor)
}
@Deprecated("Use the new setCapturedRequestHeaders() and setCapturedResponseHeaders() methods instead")
fun captureHttpHeaders(capturedHttpHeaders: io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders)
}
fun setCapturedRequestHeaders(requestHeaders: List<String>) {
httpAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders)
}

View File

@ -47,24 +47,6 @@ public final class OkHttpTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public OkHttpTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -65,41 +65,6 @@ public final class RatpackTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedServerRequestHeaders(List)} and {@link
* #setCapturedServerResponseHeaders(List)} instead.
*/
@Deprecated
public RatpackTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
return captureHttpServerHeaders(capturedHttpHeaders);
}
/**
* Configure the HTTP server instrumentation to capture chosen HTTP request and response headers
* as span attributes.
*
* @param capturedHttpServerHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedServerRequestHeaders(List)} and {@link
* #setCapturedServerResponseHeaders(List)} instead.
*/
@Deprecated
public RatpackTracingBuilder captureHttpServerHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpServerHeaders) {
httpServerAttributesExtractorBuilder.captureHttpHeaders(capturedHttpServerHeaders);
return this;
}
/**
* Configures the HTTP server request headers that will be captured as span attributes.
*
@ -120,24 +85,6 @@ public final class RatpackTracingBuilder {
return this;
}
/**
* Configure the HTTP client instrumentation to capture chosen HTTP request and response headers
* as span attributes.
*
* @param capturedHttpClientHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedClientRequestHeaders(List)} and {@link
* #setCapturedClientResponseHeaders(List)} instead.
*/
@Deprecated
public RatpackTracingBuilder captureHttpClientHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpClientHeaders) {
httpClientAttributesExtractorBuilder.captureHttpHeaders(capturedHttpClientHeaders);
return this;
}
/**
* Configures the HTTP client request headers that will be captured as span attributes.
*

View File

@ -45,24 +45,6 @@ public final class RestletTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public RestletTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -41,24 +41,6 @@ public final class RestletTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public RestletTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -44,24 +44,6 @@ public final class SpringWebTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public SpringWebTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -47,24 +47,6 @@ public final class SpringWebfluxTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public SpringWebfluxTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*

View File

@ -46,24 +46,6 @@ public final class SpringWebMvcTracingBuilder {
return this;
}
/**
* Configure the instrumentation to capture chosen HTTP request and response headers as span
* attributes.
*
* @param capturedHttpHeaders An instance of {@link
* io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders} containing the
* configured HTTP request and response names.
* @deprecated Use {@link #setCapturedRequestHeaders(List)} and {@link
* #setCapturedResponseHeaders(List)} instead.
*/
@Deprecated
public SpringWebMvcTracingBuilder captureHttpHeaders(
io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders
capturedHttpHeaders) {
this.httpAttributesExtractorBuilder.captureHttpHeaders(capturedHttpHeaders);
return this;
}
/**
* Configures the HTTP request headers that will be captured as span attributes.
*