/** * Wrapper method to create new child TraceScope with the given description * and parent scope's spanId * @param span parent span * @return TraceScope or null when not tracing */ public static TraceScope createTrace(String description, Span span) { if(span == null) return createTrace(description); return (tracer == null) ? null : tracer.newScope(description, span.getSpanId()); }
List<Span> roots = new LinkedList<>(); TraceTree traceTree = new TraceTree(spans); roots.addAll(traceTree.getSpansByParent().find(createTableSpan.getSpanId())); traceTree = new TraceTree(spans); roots.clear(); roots.addAll(traceTree.getSpansByParent().find(putSpan.getSpanId())); assertEquals(1, roots.size());
/** * Returns the span ID which this scope is managing. */ public SpanId getSpanId() { return span.getSpanId(); }
/** * Returns the span ID which this scope is managing. * * @return The span ID. */ public SpanId getSpanId() { return span.getSpanId(); }
public static SpanId getCurrentSpanId() { TraceScope curScope = threadLocalScope.get(); if (curScope == null) { return SpanId.INVALID; } else { return curScope.getSpan().getSpanId(); } }
public static SpanId getCurrentSpanId() { TraceScope curScope = threadLocalScope.get(); if (curScope == null) { return SpanId.INVALID; } else { return curScope.getSpan().getSpanId(); } }
/** * Wrapper method to create new child TraceScope with the given description * and parent scope's spanId * @param span parent span * @return TraceScope or null when not tracing */ public static TraceScope createTrace(String description, Span span) { if(span == null) return createTrace(description); return (tracer == null) ? null : tracer.newScope(description, span.getSpanId()); }
/** * Wrapper method to create new child TraceScope with the given description * and parent scope's spanId * @param span parent span * @return TraceScope or null when not tracing */ public static TraceScope createTrace(String description, Span span) { if(span == null) return createTrace(description); return (tracer == null) ? null : tracer.newScope(description, span.getSpanId()); }
@Override public void run() { TraceScope chunk = tracer.newScope(description, parent.getSpan().getSpanId()); try { runnable.run(); } finally { chunk.close(); } }
@Override public V call() throws Exception { TraceScope chunk = tracer.newScope(description, parent.getSpan().getSpanId()); try { return impl.call(); } finally { chunk.close(); } }
private TraceScope newScopeImpl(ThreadContext context, String description, TraceScope parentScope) { SpanId parentId = parentScope.getSpan().getSpanId(); Span span = new MilliSpan.Builder(). tracerId(tracerId). begin(System.currentTimeMillis()). description(description). parents(new SpanId[] { parentId }). spanId(parentId.newChildId()). build(); return context.pushNewScope(this, span, parentScope); }
private TraceScope newScopeImpl(ThreadContext context, String description, TraceScope parentScope, SpanId secondParentId) { SpanId parentId = parentScope.getSpan().getSpanId(); Span span = new MilliSpan.Builder(). tracerId(tracerId). begin(System.currentTimeMillis()). description(description). parents(new SpanId[] { parentId, secondParentId }). spanId(parentId.newChildId()). build(); return context.pushNewScope(this, span, parentScope); }
private TraceScope newScopeImpl(ThreadContext context, String description, TraceScope parentScope) { SpanId parentId = parentScope.getSpan().getSpanId(); Span span = new MilliSpan.Builder(). tracerId(tracerId). begin(System.currentTimeMillis()). description(description). parents(new SpanId[] { parentId }). spanId(parentId.newChildId()). build(); return context.pushNewScope(this, span, parentScope); }
private TraceScope newScopeImpl(ThreadContext context, String description, TraceScope parentScope, SpanId secondParentId) { SpanId parentId = parentScope.getSpan().getSpanId(); Span span = new MilliSpan.Builder(). tracerId(tracerId). begin(System.currentTimeMillis()). description(description). parents(new SpanId[] { parentId, secondParentId }). spanId(parentId.newChildId()). build(); return context.pushNewScope(this, span, parentScope); }