Skip to content

Commit

Permalink
Remove deprecated HTTP semconv code (#7259)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Nov 21, 2022
1 parent 2780561 commit 72cc791
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,13 @@ public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
REQUEST, RESPONSE, HttpServerAttributesGetter<REQUEST, RESPONSE>>
implements SpanKeyProvider {

/**
* Creates the HTTP server attributes extractor with default configuration.
*
* @deprecated Use {@link #create(HttpServerAttributesGetter, NetServerAttributesGetter)} instead.
*/
@Deprecated
public static <REQUEST, RESPONSE> HttpServerAttributesExtractor<REQUEST, RESPONSE> create(
HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) {
return create(httpAttributesGetter, new NoopNetServerAttributesGetter<>());
}

/** Creates the HTTP server attributes extractor with default configuration. */
public static <REQUEST, RESPONSE> HttpServerAttributesExtractor<REQUEST, RESPONSE> create(
HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter,
NetServerAttributesGetter<REQUEST> netAttributesGetter) {
return builder(httpAttributesGetter, netAttributesGetter).build();
}

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

/**
* Returns a new {@link HttpServerAttributesExtractorBuilder} that can be used to configure the
* HTTP client attributes extractor.
Expand Down Expand Up @@ -186,26 +162,4 @@ private String clientIp(REQUEST request) {
public SpanKey internalGetSpanKey() {
return SpanKey.HTTP_SERVER;
}

private static class NoopNetServerAttributesGetter<REQUEST>
implements NetServerAttributesGetter<REQUEST> {

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

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

@Nullable
@Override
public Integer hostPort(REQUEST request) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,4 @@ public interface HttpServerAttributesGetter<REQUEST, RESPONSE>

@Nullable
String scheme(REQUEST request);

/**
* The primary server name of the matched virtual host. This should be obtained via configuration,
* not from the Host header. If no such configuration can be obtained, this method should return
* {@code null}.
*
* @deprecated This method is deprecated and will be removed in the next release.
*/
@Nullable
@Deprecated
default String serverName(REQUEST request) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the next release");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,11 @@ public interface NetClientAttributesGetter<REQUEST, RESPONSE> {
@Nullable
String transport(REQUEST request, @Nullable RESPONSE response);

/**
* Logical remote hostname.
*
* @deprecated This method is deprecated and will be removed in the next release.
*/
@Deprecated
@Nullable
default String peerName(REQUEST request, @Nullable RESPONSE response) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the next release");
}

@Nullable
default String peerName(REQUEST request) {
return peerName(request, null);
}
String peerName(REQUEST request);

/**
* Logical remote port number.
*
* @deprecated This method is deprecated and will be removed in the next release.
*/
@Deprecated
@Nullable
default Integer peerPort(REQUEST request, @Nullable RESPONSE response) {
throw new UnsupportedOperationException(
"This method is deprecated and will be removed in the next release");
}

@Nullable
default Integer peerPort(REQUEST request) {
return peerPort(request, null);
}
Integer peerPort(REQUEST request);

@Nullable
default String sockFamily(REQUEST request, @Nullable RESPONSE response) {
Expand Down

0 comments on commit 72cc791

Please sign in to comment.