public interface TransactionStore
| Modifier and Type | Field and Description |
|---|---|
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 |
|---|---|
void |
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 void |
endProcessorSpan(String transactionId,
String location)
End an existing span under an existing transaction.
|
default SpanMeta |
endProcessorSpan(String transactionId,
String location,
Consumer<ProcessorSpan> spanUpdater)
End an existing span under an existing transaction.
|
SpanMeta |
endProcessorSpan(String transactionId,
String location,
Consumer<ProcessorSpan> spanUpdater,
Instant endTime)
This overloading allows to end a span at given time.
|
default void |
endTransaction(String transactionId,
String rootFlowName)
End a transaction represented by provided transaction id and rootFlowName, if
exists.
|
default void |
endTransaction(String transactionId,
String rootFlowName,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
End a transaction represented by provided transaction id and rootFlowName, if
exists.
|
TransactionMeta |
endTransaction(String transactionId,
String rootFlowName,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater,
Instant endTime)
End a transaction at given end time.
|
String |
getTraceIdForTransaction(String transactionId)
Get the Trace Id associated the transaction
|
TransactionContext |
getTransactionContext(String transactionId,
org.mule.runtime.api.component.location.ComponentLocation 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
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, org.mule.runtime.api.component.location.ComponentLocation 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 - ComponentLocationContextString getTraceIdForTransaction(String transactionId)
transactionId - A unique transaction id within the context of an application. Eg.
Correlation id.default void endTransaction(String transactionId, String rootFlowName)
transactionId - A unique transaction id within the context of an application. Eg.
Correlation id.rootFlowName - Name of the flow requesting to start transaction.default void endTransaction(String transactionId, String rootFlowName, 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());
}
});
transactionId - A unique transaction id within the context of an application. Eg.
Correlation id.rootFlowName - Name of the flow requesting to start transaction.spanUpdater - Consumer to allow updating Span before ending.TransactionMeta endTransaction(String transactionId, String rootFlowName, Consumer<io.opentelemetry.api.trace.Span> spanUpdater, Instant endTime)
endTransaction(String, String, Consumer)transactionId - rootFlowName - spanUpdater - endTime - void addProcessorSpan(String containerName, TraceComponent traceComponent, io.opentelemetry.api.trace.SpanBuilder spanBuilder)
containerName - String such as Flow name that contains requested locationtraceComponent - spanBuilder - SpanBuilderdefault void endProcessorSpan(String transactionId, String location)
default SpanMeta endProcessorSpan(String transactionId, String location, Consumer<ProcessorSpan> 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 - location - spanUpdater - Consumer to allow updating Span before ending.SpanMeta endProcessorSpan(String transactionId, String location, Consumer<ProcessorSpan> spanUpdater, Instant endTime)
endProcessorSpan(String,
String, Consumer).transactionId - location - spanUpdater - endTime - Copyright © 2024 AVIO Consulting. All rights reserved.