public <T> Span start(TraceContext.ChildContextCreator<T> childContextCreator, T parentContext) { // we can't get the timestamp here as the clock has not yet been initialized return start(childContextCreator, parentContext, -1); }
public <T> Span start(TraceContext.ChildContextCreator<T> childContextCreator, T parentContext, long epochMicros) { return start(childContextCreator, parentContext, epochMicros, false); }
/** * Starts a span with a given parent context. * <p> * This method makes it possible to start a span after the parent has already ended. * </p> * * @param parentContext the trace context of the parent * @return a new started span */ public <T> Span startSpan(TraceContext.ChildContextCreator<T> childContextCreator, T parentContext) { return spanPool.createInstance().start(childContextCreator, parentContext); }
/** * @param parentContext the trace context of the parent * @param epochMicros the start timestamp of the span in microseconds after epoch * @return a new started span * @see #startSpan(TraceContext.ChildContextCreator, Object) */ public <T> Span startSpan(TraceContext.ChildContextCreator<T> childContextCreator, T parentContext, long epochMicros) { return spanPool.createInstance().start(childContextCreator, parentContext, epochMicros); }
public Span startSpan(AbstractSpan<?> parent, long epochMicros) { Span span; span = spanPool.createInstance(); final boolean dropped; Transaction transaction = currentTransaction(); if (transaction != null) { if (isTransactionSpanLimitReached(transaction)) { dropped = true; transaction.getSpanCount().getDropped().incrementAndGet(); } else { dropped = false; transaction.getSpanCount().getStarted().incrementAndGet(); } } else { dropped = false; } span.start(TraceContext.fromParent(), parent, epochMicros, dropped); return span; }
private TransactionPayload createPayloadWithRequiredValues() { final TransactionPayload payload = createPayload(); final Transaction transaction = createTransactionWithRequiredValues(); payload.getTransactions().add(transaction); Span span = new Span(mock(ElasticApmTracer.class)); span.start(TraceContext.fromParent(), transaction) .withType("type") .withSubtype("subtype") .withAction("action") .withName("name"); payload.getSpans().add(span); return payload; }
public static List<Span> getSpans(Transaction t) { List<Span> spans = new ArrayList<>(); Span span = new Span(mock(ElasticApmTracer.class)) .start(TraceContext.fromParent(), t) .withName("SELECT FROM product_types") .withType("db") .start(TraceContext.fromParent(), t) .withName("GET /api/types") .withType("request")); spans.add(new Span(mock(ElasticApmTracer.class)) .start(TraceContext.fromParent(), t) .withName("GET /api/types") .withType("request")); spans.add(new Span(mock(ElasticApmTracer.class)) .start(TraceContext.fromParent(), t) .withName("GET /api/types") .withType("request")); .start(TraceContext.fromParent(), t) .appendToName("GET ") .appendToName("test.elastic.co")