@Test public void testConvertWeaselBeaconToSpan_withErrorBeaconTrimsTooLongStackTraces() throws ServletException, IOException { MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(); mockHttpServletRequest.setParameter("k", "someKey"); mockHttpServletRequest.setParameter("s", "3776086ebf658768"); mockHttpServletRequest.setParameter("t", "3776086ebf658768"); mockHttpServletRequest.setParameter("ts", "1496753245024"); mockHttpServletRequest.setParameter("ty", "err"); mockHttpServletRequest.setParameter("pl", "e6bf60fdf2672398"); mockHttpServletRequest.setParameter("l", "http: mockHttpServletRequest.setParameter("e", "Uncaught null"); final StringBuilder stacktrace = new StringBuilder(); for (int i = 0; i < 100; i++) { stacktrace.append("at http: } mockHttpServletRequest.setParameter("st", stacktrace.toString()); mockHttpServletRequest.setParameter("c", "1"); mockHttpServletRequest.setParameter("m_user", "tom.mason@example.com"); servlet.doGet(mockHttpServletRequest, new MockHttpServletResponse()); assertSoftly(softly -> { final List<MockSpan> finishedSpans = mockTracer.finishedSpans(); softly.assertThat(finishedSpans).hasSize(1); MockSpan span = finishedSpans.get(0); softly.assertThat(span.operationName()).isEqualTo("/petclinic/"); softly.assertThat(span.finishMicros() - span.startMicros()).isZero(); softly.assertThat(span.tags()) .doesNotContainEntry(Tags.SAMPLING_PRIORITY.getKey(), 0) .containsEntry("http.url", "http: .containsEntry("type", "js_error") .containsKey("exception.stack_trace") .containsEntry("exception.message", "Uncaught null"); softly.assertThat(((String) span.tags().get("exception.stack_trace")).length()) .isLessThan(stacktrace.length()) .isGreaterThan(0); }); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { handleRequest(req, resp); }
ClientSpanServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { handleRequest(req, resp); } }
ClientSpanServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { handleRequest(req, resp); } ClientSpanServlet();   ClientSpanServlet(TracingPlugin tracingPlugin, ServletPlugin servletPlugin); }
ClientSpanServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { handleRequest(req, resp); } ClientSpanServlet();   ClientSpanServlet(TracingPlugin tracingPlugin, ServletPlugin servletPlugin);  }
ClientSpanServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { handleRequest(req, resp); } ClientSpanServlet();   ClientSpanServlet(TracingPlugin tracingPlugin, ServletPlugin servletPlugin);   }