@Override public Span createSpan() { return tracer.startSpan(fromParent(), this); }
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")