Skip to content
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

Remove deprecated instrumentation-api-semconv code #7838

Merged
merged 2 commits into from
Feb 16, 2023
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 @@ -17,36 +17,8 @@
public interface CodeAttributesGetter<REQUEST> {

@Nullable
default Class<?> getCodeClass(REQUEST request) {
return codeClass(request);
}
Class<?> getCodeClass(REQUEST request);

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getCodeClass(Object)} instead.
*/
@Deprecated
@Nullable
default Class<?> codeClass(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}

@Nullable
default String getMethodName(REQUEST request) {
return methodName(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getMethodName(Object)} instead.
*/
@Deprecated
@Nullable
default String methodName(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getMethodName(REQUEST request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,8 @@
public interface DbClientAttributesGetter<REQUEST> extends DbClientCommonAttributesGetter<REQUEST> {

@Nullable
default String getStatement(REQUEST request) {
return statement(request);
}
String getStatement(REQUEST request);

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getStatement(Object)} instead.
*/
@Deprecated
@Nullable
default String statement(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}

@Nullable
default String getOperation(REQUEST request) {
return operation(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getOperation(Object)} instead.
*/
@Deprecated
@Nullable
default String operation(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getOperation(REQUEST request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,70 +11,14 @@
public interface DbClientCommonAttributesGetter<REQUEST> {

@Nullable
default String getSystem(REQUEST request) {
return system(request);
}
String getSystem(REQUEST request);

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getSystem(Object)} instead.
*/
@Deprecated
@Nullable
default String system(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getUser(REQUEST request);

@Nullable
default String getUser(REQUEST request) {
return user(request);
}
String getName(REQUEST request);

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getUser(Object)} instead.
*/
@Deprecated
@Nullable
default String user(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}

@Nullable
default String getName(REQUEST request) {
return name(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getName(Object)} instead.
*/
@Deprecated
@Nullable
default String name(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}

@Nullable
default String getConnectionString(REQUEST request) {
return connectionString(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getConnectionString(Object)} instead.
*/
@Deprecated
@Nullable
default String connectionString(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getConnectionString(REQUEST request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,5 @@ public interface SqlClientAttributesGetter<REQUEST>
* SqlClientAttributesExtractor} before being set as span attribute.
*/
@Nullable
default String getRawStatement(REQUEST request) {
return rawStatement(request);
}

/**
* Get the raw SQL statement. The value returned by this method is later sanitized by the {@link
* SqlClientAttributesExtractor} before being set as span attribute.
*
* <p>This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getRawStatement(Object)} instead.
*/
@Deprecated
@Nullable
default String rawStatement(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getRawStatement(REQUEST request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,13 @@ public final class HttpClientAttributesExtractor<REQUEST, RESPONSE>
REQUEST, RESPONSE, HttpClientAttributesGetter<REQUEST, RESPONSE>>
implements SpanKeyProvider {

/**
* Creates the HTTP client attributes extractor with default configuration.
*
* @deprecated Use {@link #create(HttpClientAttributesGetter, NetClientAttributesGetter)} instead.
*/
@Deprecated
public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
HttpClientAttributesGetter<REQUEST, RESPONSE> getter) {
return builder(getter).build();
}

/** Creates the HTTP client attributes extractor with default configuration. */
public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
HttpClientAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter,
NetClientAttributesGetter<REQUEST, RESPONSE> netAttributesGetter) {
return builder(httpAttributesGetter, netAttributesGetter).build();
}

/**
* Returns a new {@link HttpClientAttributesExtractorBuilder} that can be used to configure the
* HTTP client attributes extractor.
*
* @deprecated Use {@link #builder(HttpClientAttributesGetter, NetClientAttributesGetter)}
* instead.
*/
@Deprecated
public static <REQUEST, RESPONSE> HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> builder(
HttpClientAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) {
return builder(httpAttributesGetter, new NoopNetClientAttributesGetter<>());
}

/**
* Returns a new {@link HttpClientAttributesExtractorBuilder} that can be used to configure the
* HTTP client attributes extractor.
Expand Down Expand Up @@ -175,26 +151,4 @@ public void onEnd(
public SpanKey internalGetSpanKey() {
return SpanKey.HTTP_CLIENT;
}

private static final class NoopNetClientAttributesGetter<REQUEST, RESPONSE>
implements NetClientAttributesGetter<REQUEST, RESPONSE> {

@Nullable
@Override
public String getTransport(REQUEST request, @Nullable RESPONSE response) {
return null;
}

@Nullable
@Override
public String getPeerName(REQUEST request) {
return null;
}

@Nullable
@Override
public Integer getPeerPort(REQUEST request) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,7 @@ public interface HttpClientAttributesGetter<REQUEST, RESPONSE>
// Attributes that always exist in a request

@Nullable
default String getUrl(REQUEST request) {
return url(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getUrl(Object)} instead.
*/
@Deprecated
@Nullable
default String url(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getUrl(REQUEST request);

// Attributes which are not always available when the request is ready.

Expand All @@ -47,24 +33,5 @@ default String url(REQUEST request) {
* {@code response} is {@code null} or not.
*/
@Nullable
default String getFlavor(REQUEST request, @Nullable RESPONSE response) {
return flavor(request, response);
}

/**
* Extracts the {@code http.flavor} span attribute.
*
* <p>This is called from {@link Instrumenter#end(Context, Object, Object, Throwable)}, whether
* {@code response} is {@code null} or not.
*
* <p>This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getFlavor(Object, Object)}.
*/
@Deprecated
@Nullable
default String flavor(REQUEST request, @Nullable RESPONSE response) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getFlavor(REQUEST request, @Nullable RESPONSE response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,7 @@ public interface HttpCommonAttributesGetter<REQUEST, RESPONSE> {
// Attributes that always exist in a request

@Nullable
default String getMethod(REQUEST request) {
return method(request);
}

/**
* This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getMethod(Object)} instead.
*/
@Deprecated
@Nullable
default String method(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
String getMethod(REQUEST request);

/**
* Extracts all values of header named {@code name} from the request, or an empty list if there
Expand All @@ -39,26 +25,7 @@ default String method(REQUEST request) {
* <p>Implementations of this method <b>must not</b> return a null value; an empty list should be
* returned instead.
*/
default List<String> getRequestHeader(REQUEST request, String name) {
return requestHeader(request, name);
}

/**
* Extracts all values of header named {@code name} from the request, or an empty list if there
* were none.
*
* <p>Implementations of this method <b>must not</b> return a null value; an empty list should be
* returned instead.
*
* <p>This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getRequestHeader(Object, String)} instead.
*/
@Deprecated
default List<String> requestHeader(REQUEST request, String name) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
List<String> getRequestHeader(REQUEST request, String name);

// Attributes which are not always available when the request is ready.

Expand All @@ -69,26 +36,7 @@ default List<String> requestHeader(REQUEST request, String name) {
* {@code response} is non-{@code null}.
*/
@Nullable
default Integer getStatusCode(REQUEST request, RESPONSE response, @Nullable Throwable error) {
return statusCode(request, response, error);
}

/**
* Extracts the {@code http.status_code} span attribute.
*
* <p>This is called from {@link Instrumenter#end(Context, Object, Object, Throwable)}, only when
* {@code response} is non-{@code null}.
*
* <p>This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getStatusCode(Object, Object, Throwable)} instead.
*/
@Deprecated
@Nullable
default Integer statusCode(REQUEST request, RESPONSE response, @Nullable Throwable error) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
Integer getStatusCode(REQUEST request, RESPONSE response, @Nullable Throwable error);

/**
* Extracts all values of header named {@code name} from the response, or an empty list if there
Expand All @@ -100,27 +48,5 @@ default Integer statusCode(REQUEST request, RESPONSE response, @Nullable Throwab
* <p>Implementations of this method <b>must not</b> return a null value; an empty list should be
* returned instead.
*/
default List<String> getResponseHeader(REQUEST request, RESPONSE response, String name) {
return responseHeader(request, response, name);
}

/**
* Extracts all values of header named {@code name} from the response, or an empty list if there
* were none.
*
* <p>This is called from {@link Instrumenter#end(Context, Object, Object, Throwable)}, only when
* {@code response} is non-{@code null}.
*
* <p>Implementations of this method <b>must not</b> return a null value; an empty list should be
* returned instead.
*
* <p>This method is deprecated and will be removed in the subsequent release.
*
* @deprecated Use {@link #getResponseHeader(Object, Object, String)} instead.
*/
@Deprecated
default List<String> responseHeader(REQUEST request, RESPONSE response, String name) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the subsequent release.");
}
List<String> getResponseHeader(REQUEST request, RESPONSE response, String name);
}
Loading