opentracing-contrib / java-web-servlet-filter

OpenTracing Java Web Servlet Filter Instrumentation
Apache License 2.0
24 stars 31 forks source link

Use getRequestURL instead of getMethod for naming the spans #45

Closed piyushkumar13 closed 6 years ago

piyushkumar13 commented 6 years ago

https://github.com/opentracing-contrib/java-web-servlet-filter/blob/87314176e9e9bd828390bc285f68ad3686f509e7/opentracing-web-servlet-filter/src/main/java/io/opentracing/contrib/web/servlet/filter/TracingFilter.java#L162

Giving name to spans based on the HTTP Method does not look intuitive on the tracers UI(Jaeger, Lightstep, Zipkin etc). For example there can be several PUT requests and the span will look in the UI with name "PUT" in the tracer. A viewer cannot figure out that PUT request is related with which URL(or which service) until he click on the span and checks the tags. Here is the view from Lightstep (Note : regdiscovery-tracer is the name of the tracer)

screen shot 2018-10-26 at 10 26 12 pm

I think it will good to use request URL instead of HTTP Method so that viewer at the first view on the tracer UI can figure out the particular span is meant for which http request.

pavolloffay commented 6 years ago

We cannot use URL as operation name due to high cardinality. For example requests for the same operation might have two different URLs e.g. wildcard mapping.

piyushkumar13 commented 6 years ago

@pavolloffay Agreed. But you can use combination of both HTTPMethod and RequestURL. Ex - GET<space>http://localhost:9999/hello. It will be more distinguishing instead of just using HTTPMethod.