use of co.elastic.apm.agent.impl.transaction.TraceContext in project apm-agent-java by elastic.
the class OTelBridgeStepsDefinitions method bridgedSpanHasLocalParent.
@Then("Elastic bridged span has local context as parent")
public void bridgedSpanHasLocalParent() {
assertThat(localParentContext).isNotNull();
SpanContext otelParentContext = io.opentelemetry.api.trace.Span.fromContext(localParentContext).getSpanContext();
TraceContext bridgedSpanContext = getBridgedSpan().getTraceContext();
assertThat(bridgedSpanContext.getTraceId().toString()).isEqualTo(otelParentContext.getTraceId());
assertThat(bridgedSpanContext.getParentId().toString()).isEqualTo(otelParentContext.getSpanId());
}
use of co.elastic.apm.agent.impl.transaction.TraceContext in project apm-agent-java by elastic.
the class ElasticApmApiInstrumentationTest method checkTransactionServiceInfo.
private void checkTransactionServiceInfo(ServiceInfo expected) {
TraceContext traceContext = reporter.getFirstTransaction().getTraceContext();
assertThat(traceContext.getServiceName()).isEqualTo(expected.getServiceName());
assertThat(traceContext.getServiceVersion()).isEqualTo(expected.getServiceVersion());
}
use of co.elastic.apm.agent.impl.transaction.TraceContext in project apm-agent-java by elastic.
the class ElasticApmTracerTest method checkServiceInfo.
private static void checkServiceInfo(Transaction transaction, ServiceInfo expected) {
TraceContext traceContext = transaction.getTraceContext();
assertThat(traceContext.getServiceName()).isEqualTo(expected.getServiceName());
assertThat(traceContext.getServiceVersion()).isEqualTo(expected.getServiceVersion());
}
use of co.elastic.apm.agent.impl.transaction.TraceContext in project apm-agent-java by elastic.
the class AbstractLambdaTest method testTraceContext.
@Test
public void testTraceContext() {
ReqE input = createInput();
if (!supportsContextPropagation()) {
return;
}
getFunction().handleRequest(input, context);
Transaction transaction = reporter.getFirstTransaction();
TraceContext traceContext = transaction.getTraceContext();
assertThat(traceContext.getTraceId().toString()).isEqualTo(TRACE_ID_EXAMPLE);
assertThat(traceContext.getParentId().toString()).isEqualTo(PARENT_ID_EXAMPLE);
assertThat(traceContext.getTraceState().getSampleRate()).isEqualTo(0.77d);
}
use of co.elastic.apm.agent.impl.transaction.TraceContext in project apm-agent-java by elastic.
the class CallTreeTest method rootTraceContext.
public static TraceContext rootTraceContext(ElasticApmTracer tracer) {
TraceContext traceContext = TraceContext.with64BitId(tracer);
traceContext.asRootSpan(ConstantSampler.of(true));
return traceContext;
}
Aggregations