use of co.elastic.apm.impl.transaction.Transaction in project apm-agent-java by elastic.
the class BodyProcessorTest method processTransaction.
private Transaction processTransaction() {
final Transaction transaction = new Transaction();
transaction.getContext().getRequest().withRawBody("foo");
bodyProcessor.processBeforeReport(transaction);
return transaction;
}
use of co.elastic.apm.impl.transaction.Transaction in project apm-agent-java by elastic.
the class ElasticApmTracer method captureException.
public void captureException(Exception e) {
ErrorCapture error = new ErrorCapture();
error.getId().setToRandomValue();
error.withTimestamp(System.currentTimeMillis());
error.getException().withMessage(e.getMessage());
error.getException().withType(e.getClass().getName());
stacktraceFactory.fillStackTrace(error.getException().getStacktrace(), e.getStackTrace());
Transaction transaction = currentTransaction();
if (transaction != null) {
error.getTransaction().withId(transaction.getId());
error.getContext().copyFrom(transaction.getContext());
}
reporter.report(error);
}
use of co.elastic.apm.impl.transaction.Transaction in project apm-agent-java by elastic.
the class ElasticApmTracer method startTransaction.
@Nonnull
@Override
public Transaction startTransaction() {
Transaction transaction;
if (!coreConfiguration.isActive()) {
transaction = noopTransaction;
} else {
transaction = transactionPool.createInstance().start(this, System.nanoTime(), sampler);
}
currentTransaction.set(transaction);
return transaction;
}
use of co.elastic.apm.impl.transaction.Transaction in project apm-agent-java by elastic.
the class ElasticApmTracer method startSpan.
@Nonnull
@Override
public Span startSpan() {
Transaction transaction = currentTransaction();
final Span span;
// even when setting active=false mid-transaction
if (isNoop(transaction)) {
span = noopSpan;
} else {
span = createRealSpan(transaction);
}
currentSpan.set(span);
return span;
}
use of co.elastic.apm.impl.transaction.Transaction in project apm-agent-java by elastic.
the class BodyProcessorTest method processBeforeReport_Transaction_EventTypeAll.
@Test
void processBeforeReport_Transaction_EventTypeAll() {
when(config.getCaptureBody()).thenReturn(WebConfiguration.EventType.ALL);
final Transaction transaction = processTransaction();
assertThat(transaction.getContext().getRequest().getBody()).isEqualTo("foo");
}
Aggregations