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 peer service fallback to server.socket.* #9369

Merged
merged 1 commit into from
Sep 5, 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 @@ -9,6 +9,7 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.network.ServerAttributesGetter;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.Map;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void onEnd(

String serverAddress = attributesGetter.getServerAddress(request);
String peerService = mapToPeerService(serverAddress);
if (peerService == null) {
if (peerService == null && SemconvStability.emitOldHttpSemconv()) {
String serverSocketDomain = attributesGetter.getServerSocketDomain(request, response);
peerService = mapToPeerService(serverSocketDomain);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.network.ServerAttributesGetter;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand Down Expand Up @@ -101,6 +103,9 @@ void shouldSetPeerNameIfItMatches() {

@Test
void shouldSetSockPeerNameIfItMatchesAndNoPeerNameProvided() {

Assumptions.assumeTrue(SemconvStability.emitOldHttpSemconv());

// given
Map<String, String> peerServiceMapping = new HashMap<>();
peerServiceMapping.put("example.com", "myService");
Expand Down