@Test public void testStartNestedSpanWhenSpanNotNull() { final String name = "name"; final String event = "event"; final Span span = mock(Span.class); final Span nestedSpan = mock(Span.class); when(mockTracer.createSpan(anyString(), any(Span.class))).thenReturn(nestedSpan); final Span result = kermossTracerUnderTest.startNestedSpan(name, event, span); verify(nestedSpan).logEvent(same(event)); assertEquals(result, nestedSpan); }
public Span startNestedSpan(String name, String event, Span span) { Span nestedSpan = null; if (span != null) { Span tnestedSpan = tracer.createSpan(name, span); tnestedSpan.logEvent(event); span.tags().forEach((k, v) -> { tnestedSpan.tag(k, v); }); nestedSpan = tnestedSpan; } return nestedSpan; }
KermossTracer { public Span startNestedSpan(String name, String event, Span span) { Span nestedSpan = null; if (span != null) { Span tnestedSpan = tracer.createSpan(name, span); tnestedSpan.logEvent(event); span.tags().forEach((k, v) -> { tnestedSpan.tag(k, v); }); nestedSpan = tnestedSpan; } return nestedSpan; } }
KermossTracer { public Span startNestedSpan(String name, String event, Span span) { Span nestedSpan = null; if (span != null) { Span tnestedSpan = tracer.createSpan(name, span); tnestedSpan.logEvent(event); span.tags().forEach((k, v) -> { tnestedSpan.tag(k, v); }); nestedSpan = tnestedSpan; } return nestedSpan; }  }
KermossTracer { public Span startNestedSpan(String name, String event, Span span) { Span nestedSpan = null; if (span != null) { Span tnestedSpan = tracer.createSpan(name, span); tnestedSpan.logEvent(event); span.tags().forEach((k, v) -> { tnestedSpan.tag(k, v); }); nestedSpan = tnestedSpan; } return nestedSpan; }  @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) void closeSpan(GtxSpanStarted gtxSpanStarted); @TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK) void closeSpanE(GtxSpanStarted gtxSpanStarted); Span startGtxSpan(String name, String gtx, String traceId, Span span); Span startGtxSpan(GlobalTransaction gt, Span span); Span startNestedSpan(String name, String event, Span span); void closeSpan(Span span); Span currentSpan(); }
KermossTracer { public Span startNestedSpan(String name, String event, Span span) { Span nestedSpan = null; if (span != null) { Span tnestedSpan = tracer.createSpan(name, span); tnestedSpan.logEvent(event); span.tags().forEach((k, v) -> { tnestedSpan.tag(k, v); }); nestedSpan = tnestedSpan; } return nestedSpan; }  @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) void closeSpan(GtxSpanStarted gtxSpanStarted); @TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK) void closeSpanE(GtxSpanStarted gtxSpanStarted); Span startGtxSpan(String name, String gtx, String traceId, Span span); Span startGtxSpan(GlobalTransaction gt, Span span); Span startNestedSpan(String name, String event, Span span); void closeSpan(Span span); Span currentSpan();  }