diff --git a/opentracing-web-servlet-filter/src/main/java/io/opentracing/contrib/web/servlet/filter/TracingFilter.java b/opentracing-web-servlet-filter/src/main/java/io/opentracing/contrib/web/servlet/filter/TracingFilter.java index f4e04b2..1230752 100644 --- a/opentracing-web-servlet-filter/src/main/java/io/opentracing/contrib/web/servlet/filter/TracingFilter.java +++ b/opentracing-web-servlet-filter/src/main/java/io/opentracing/contrib/web/servlet/filter/TracingFilter.java @@ -158,7 +158,7 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo SpanContext extractedContext = tracer.extract(Format.Builtin.HTTP_HEADERS, new HttpServletRequestExtractAdapter(httpRequest)); - final Span span = tracer.buildSpan(httpRequest.getMethod()) + final Span span = tracer.buildSpan(httpRequest.getRequestURI()) .asChildOf(extractedContext) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER) .start(); diff --git a/opentracing-web-servlet-filter/src/test/java/io/opentracing/contrib/web/servlet/filter/TracingFilterTest.java b/opentracing-web-servlet-filter/src/test/java/io/opentracing/contrib/web/servlet/filter/TracingFilterTest.java index e38fb68..48ce69f 100644 --- a/opentracing-web-servlet-filter/src/test/java/io/opentracing/contrib/web/servlet/filter/TracingFilterTest.java +++ b/opentracing-web-servlet-filter/src/test/java/io/opentracing/contrib/web/servlet/filter/TracingFilterTest.java @@ -45,7 +45,7 @@ public void testHelloRequest() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/hello", mockSpan.operationName()); Assert.assertEquals(5, mockSpan.tags().size()); Assert.assertEquals(Tags.SPAN_KIND_SERVER, mockSpan.tags().get(Tags.SPAN_KIND.getKey())); Assert.assertEquals("GET", mockSpan.tags().get(Tags.HTTP_METHOD.getKey())); @@ -91,7 +91,7 @@ public void testNotExistingUrl() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/doesNotExist", mockSpan.operationName()); Assert.assertEquals(5, mockSpan.tags().size()); Assert.assertEquals(Tags.SPAN_KIND_SERVER, mockSpan.tags().get(Tags.SPAN_KIND.getKey())); Assert.assertEquals("GET", mockSpan.tags().get(Tags.HTTP_METHOD.getKey())); @@ -117,7 +117,7 @@ public void testFilterException() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/filterException", mockSpan.operationName()); Assert.assertEquals(6, mockSpan.tags().size()); Assert.assertEquals(Tags.SPAN_KIND_SERVER, mockSpan.tags().get(Tags.SPAN_KIND.getKey())); Assert.assertEquals("GET", mockSpan.tags().get(Tags.HTTP_METHOD.getKey())); @@ -150,7 +150,7 @@ public void testServletException() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/servletException", mockSpan.operationName()); Assert.assertEquals(6, mockSpan.tags().size()); Assert.assertEquals(Tags.SPAN_KIND_SERVER, mockSpan.tags().get(Tags.SPAN_KIND.getKey())); Assert.assertEquals("GET", mockSpan.tags().get(Tags.HTTP_METHOD.getKey())); @@ -209,7 +209,7 @@ public void testAsync() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/async", mockSpan.operationName()); Assert.assertTrue(AsyncServlet.ASYNC_SLEEP_TIME_MS <= mockSpan.finishMicros() - mockSpan.startMicros()); Assert.assertEquals(5, mockSpan.tags().size()); @@ -237,7 +237,7 @@ public void testAsyncImmediateExit() throws IOException { assertOnErrors(mockSpans); MockSpan mockSpan = mockSpans.get(0); - Assert.assertEquals("GET", mockSpan.operationName()); + Assert.assertEquals("/context/asyncImmediateExit", mockSpan.operationName()); Assert.assertEquals(5, mockSpan.tags().size()); Assert.assertEquals(Tags.SPAN_KIND_SERVER, mockSpan.tags().get(Tags.SPAN_KIND.getKey()));