janhoy commented on code in PR #1342:
URL: https://github.com/apache/solr/pull/1342#discussion_r1101290759


##########
solr/core/src/java/org/apache/solr/servlet/ServletUtils.java:
##########
@@ -310,7 +310,11 @@ protected static Span buildSpan(Tracer tracer, 
HttpServletRequest request) {
             .asChildOf(tracer.extract(Format.Builtin.HTTP_HEADERS, new 
HttpServletCarrier(request)))
             .withTag(Tags.SPAN_KIND, Tags.SPAN_KIND_SERVER)
             .withTag(Tags.HTTP_METHOD, request.getMethod())
-            .withTag(Tags.HTTP_URL, request.getRequestURL().toString());
+            .withTag(Tags.HTTP_URL, request.getRequestURL().toString())
+            .withTag("net.host.name", request.getServerName())
+            .withTag("net.host.port", request.getServerPort())
+            .withTag("net.peer.name", request.getRemoteHost())
+            .withTag("net.peer.port", request.getRemotePort());

Review Comment:
   I'm no expert here, but the opentelemetry semantic conventions seem to have 
evolved and differ from what OpenTracing used. I don't know the history here, 
but OT is now part of OTEL, so I interpreted that `peer.hostname` is the old OT 
tag name while `net.peer.name` is the new OTEL name. Thus there was no constant 
available. 
   
   The `opentelemetry-semconv` dependency which we currently do not pull in, 
contains such constants in 
[SemanticAttributes.java](https://github.com/open-telemetry/opentelemetry-java/blob/main/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java).
 A bit overkill to pull that in for four string constants though.
   
   The question then is - since this is shared code between Jaeger and OTEL, 
and they both expect different tag names (the others, SPAN_KIND, HTTP_METHOD, 
HTTP_URL are the same), if we should tag both variants, or find some way to 
choose tags based on active module. Trick is that in `ServletUtils` class we 
only have a tracer instance and don't know the active module. Only way I can 
think of is to do `tracer instanceof 
io.opentelemetry.opentracingshim.TracerShim`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to