More metrics
MODIFY
instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java
instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java
@@ -9,6 +9,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.PeerServiceAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import java.net.HttpURLConnection;
@@ -30,6 +31,7 @@ public class HttpUrlConnectionSingletons {
.addAttributesExtractor(httpAttributesExtractor)
.addAttributesExtractor(netAttributesExtractor)
.addAttributesExtractor(PeerServiceAttributesExtractor.create(netAttributesExtractor))
+ .addRequestMetrics(HttpClientMetrics.get())
.newClientInstrumenter(RequestPropertySetter.INSTANCE);
}

MODIFY
instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackTracingBuilder.java
instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackTracingBuilder.java
@@ -9,8 +9,8 @@ import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.api.config.Config;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders;
+import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.ratpack.internal.RatpackNetAttributesExtractor;
@@ -62,15 +62,16 @@ public final class RatpackTracingBuilder {
RatpackHttpAttributesExtractor httpAttributes =
new RatpackHttpAttributesExtractor(capturedHttpHeaders);
- InstrumenterBuilder<Request, Response> builder =
- Instrumenter.builder(
- openTelemetry, INSTRUMENTATION_NAME, HttpSpanNameExtractor.create(httpAttributes));
+ Instrumenter<Request, Response> instrumenter =
+ Instrumenter.<Request, Response>builder(
+ openTelemetry, INSTRUMENTATION_NAME, HttpSpanNameExtractor.create(httpAttributes))
+ .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributes))
+ .addAttributesExtractor(netAttributes)
+ .addAttributesExtractor(httpAttributes)
+ .addAttributesExtractors(additionalExtractors)
+ .addRequestMetrics(HttpServerMetrics.get())
+ .newServerInstrumenter(new RatpackGetter());
- builder.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributes));
- builder.addAttributesExtractor(netAttributes);
- builder.addAttributesExtractor(httpAttributes);
- builder.addAttributesExtractors(additionalExtractors);
-
- return new RatpackTracing(builder.newServerInstrumenter(new RatpackGetter()));
+ return new RatpackTracing(instrumenter);
}
}

MODIFY
instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletTracingBuilder.java
instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletTracingBuilder.java
@@ -12,6 +12,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.CapturedHttpHeaders;
+import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor;
@@ -76,6 +77,7 @@ public final class RestletTracingBuilder {
.addAttributesExtractor(httpAttributesExtractor)
.addAttributesExtractor(netAttributesExtractor)
.addAttributesExtractors(additionalExtractors)
+ .addRequestMetrics(HttpServerMetrics.get())
.newServerInstrumenter(new RestletHeadersGetter());
return new RestletTracing(instrumenter);

More metrics (#4541)