Peer service optimization
MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java
@@ -58,6 +58,12 @@ public final class PeerServiceAttributesExtractor<REQUEST, RESPONSE>
REQUEST request,
@Nullable RESPONSE response,
@Nullable Throwable error) {
+
+ if (peerServiceMapping.isEmpty()) {
+ // optimization for common case
+ return;
+ }
+
String peerName = netClientAttributesExtractor.peerName(request, response);
String peerService = mapToPeerService(peerName);
if (peerService == null) {

Peer service optimization (#5056)