Add deprecation cycle for removed methods
Methods were removed in which was backported to the 1.19.x branch
and included in the 1.19.1 release.
MODIFY
instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java
instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java
@@ -36,6 +36,17 @@ 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,
@@ -43,6 +54,19 @@ public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
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.
@@ -162,4 +186,26 @@ public final class HttpServerAttributesExtractor<REQUEST, RESPONSE>
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;
+ }
+ }
}

Add deprecation cycle for removed methods (#7020)

Methods were removed in #6892, which was backported to the 1.19.x branch
and included in the 1.19.1 release.