@Override public RunningSpanStore getRunningSpanStore() { return RunningSpanStore.getNoopRunningSpanStore(); }
@Test public void emitSummaryTableForEachSpan() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); assertThat(output.toString()).contains(ACTIVE_SPAN_NAME); assertThat(output.toString()).contains(SAMPLED_SPAN_NAME); assertThat(output.toString()).contains(ACTIVE_SAMPLED_SPAN_NAME); }
@Test public void noopRunningSpanStore_GetRunningSpans_DisallowsNull() { thrown.expect(NullPointerException.class); runningSpanStore.getRunningSpans(null); }
return; RunningSpanStore.Summary runningSpanStoreSummary = runningSpanStore.getSummary(); SampledSpanStore.Summary sampledSpanStoreSummary = sampledSpanStore.getSummary();
@Test public void noopRunningSpanStore_GetRunningSpans() { Collection<SpanData> runningSpans = runningSpanStore.getRunningSpans(RunningSpanStore.Filter.create("TestSpan", 0)); assertThat(runningSpans).isEmpty(); } }
@Test public void noopRunningSpanStore_GetSummary() { RunningSpanStore.Summary summary = runningSpanStore.getSummary(); assertThat(summary.getPerSpanNameSummary()).isEmpty(); }
@Override public RunningSpanStore getRunningSpanStore() { return RunningSpanStore.getNoopRunningSpanStore(); }
runningSpanStore.getRunningSpans(RunningSpanStore.Filter.create(spanName, 0)));
@Test public void linksForActiveRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // 3 active requests assertThat(output.toString()).contains("href='?zspanname=TestActiveSpan&ztype=0&zsubtype=0'>3"); // No active links assertThat(output.toString()) .doesNotContain("href='?zspanname=TestSampledSpan&ztype=0&zsubtype=0'"); // 5 active requests assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=0&zsubtype=0'>5"); }
@Test public void implementationOfActiveSpans() { assertThat(exportComponent.getRunningSpanStore()) .isEqualTo(RunningSpanStore.getNoopRunningSpanStore()); }
@Test public void linksForFailedRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // No sampled links (ztype=1); assertThat(output.toString()).doesNotContain("href=\"?zspanname=TestActiveSpan&ztype=2"); // Links for 7 errors 2 CANCELLED + 5 DEADLINE_EXCEEDED; assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=2&zsubtype=0'>7"); // Links for 7 errors 2 CANCELLED + 5 DEADLINE_EXCEEDED; assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=2&zsubtype=0'>7"); }
@Test public void linksForSampledRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // No sampled links (ztype=1); assertThat(output.toString()).doesNotContain("href=\"?zspanname=TestActiveSpan&ztype=1"); // Links for 7 samples [10us, 100us) and 3 samples [1ms, 10ms); assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=1&zsubtype=1'>7"); assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=1&zsubtype=3'>3"); // Links for 7 samples [10us, 100us) and 3 samples [1ms, 10ms); assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=1&zsubtype=1'>7"); assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=1&zsubtype=3'>3"); }