public interface TransactionStore
| Modifier and Type | Field and Description |
|---|---|
static String |
OTEL_FLOW_CONTEXT_ID |
static String |
OTEL_FLOW_PREV_CONTEXT_ID |
static String |
SPAN_ID |
static String |
TRACE_CONTEXT_MAP_KEY |
static String |
TRACE_ID |
static String |
TRACE_PREV_CONTEXT_MAP_KEY |
static String |
TRACE_TRANSACTION_ID |
| Modifier and Type | Method and Description |
|---|---|
SpanMeta |
addProcessorSpan(String containerName,
TraceComponent traceComponent,
io.opentelemetry.api.trace.SpanBuilder spanBuilder)
Add a new processor span under an existing transaction.
|
void |
addTransactionTags(String transactionId,
String tagPrefix,
Map<String,String> tags)
Add custom tags to an existing transaction.
|
default SpanMeta |
endProcessorSpan(String transactionId,
TraceComponent traceComponent,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
End an existing span under an existing transaction.
|
SpanMeta |
endProcessorSpan(String transactionId,
TraceComponent traceComponent,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater,
Instant endTime)
This overloading allows to end a span at given time.
|
TransactionMeta |
endTransaction(TraceComponent traceComponent,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
End a transaction represented by provided transaction id and rootFlowName, if
exists.
|
TransactionContext |
getTransactionContext(String transactionId,
String componentLocation)
Get the
Context of the initiating flow span. |
void |
startTransaction(TraceComponent traceComponent,
String rootFlowName,
io.opentelemetry.api.trace.SpanBuilder rootFlowSpan)
Start a new transaction.
|
default String |
transactionIdFor(org.mule.runtime.api.event.Event muleEvent)
A default implementation to get a mule correlation id as a local transaction
id.
|
static final String TRACE_TRANSACTION_ID
static final String TRACE_CONTEXT_MAP_KEY
static final String TRACE_PREV_CONTEXT_MAP_KEY
static final String TRACE_ID
static final String SPAN_ID
static final String OTEL_FLOW_CONTEXT_ID
static final String OTEL_FLOW_PREV_CONTEXT_ID
default String transactionIdFor(org.mule.runtime.api.event.Event muleEvent)
muleEvent - EventString transaction idvoid startTransaction(TraceComponent traceComponent, String rootFlowName, io.opentelemetry.api.trace.SpanBuilder rootFlowSpan)
traceComponent - TraceComponent with tracing informationrootFlowName - Name of the flow requesting to start transaction.rootFlowSpan - SpanBuilder for building the root span.void addTransactionTags(String transactionId, String tagPrefix, Map<String,String> tags)
TransactionContext getTransactionContext(String transactionId, String componentLocation)
Context of the initiating flow span. This may be required to
propagate
context for a given transaction.transactionId - A unique transaction id within the context of an application. Eg.
Correlation id.componentLocation - ComponentLocationContextTransactionMeta endTransaction(TraceComponent traceComponent, Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
Consumer parameter allows updating the Span before ending. This is
useful in scenarios
like setting processing status code to error.
Here is an example of setting Error when processor execution fails.
transactionStore.endTransaction(traceComponent.getTransactionId(), traceComponent.getName(), rootSpan -> {
if(notification.getException() != null) {
rootSpan.setStatus(StatusCode.ERROR, notification.getException().getMessage());
rootSpan.recordException(notification.getException());
}
});
SpanMeta addProcessorSpan(String containerName, TraceComponent traceComponent, io.opentelemetry.api.trace.SpanBuilder spanBuilder)
containerName - String such as Flow name that contains requested locationtraceComponent - TraceComponent for spanspanBuilder - SpanBuilderdefault SpanMeta endProcessorSpan(String transactionId, TraceComponent traceComponent, Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
Consumer
parameter allows
updating the Span before ending. This is useful in scenarios like setting
processing status
code to error.
Here is an example of setting Error when processor execution fails.
transactionStore.endProcessorSpan(traceComponent.getTransactionId(), traceComponent.getLocation(), s -> {
if(notification.getEvent().getError().isPresent()) {
Error error = notification.getEvent().getError().get();
s.setStatus(StatusCode.ERROR, error.getDescription());
s.recordException(error.getCause());
}
});
transactionId - StringtraceComponent - TraceComponentspanUpdater - Consumer to allow updating Span before ending.SpanMeta endProcessorSpan(String transactionId, TraceComponent traceComponent, Consumer<io.opentelemetry.api.trace.Span> spanUpdater, Instant endTime)
transactionId - StringtraceComponent - TraceComponentspanUpdater - Consumer to allow updating Span before ending.endTime - Instant of span endCopyright © 2024 AVIO Consulting. All rights reserved.