public interface TransactionStore
| Modifier and Type | Field and Description |
|---|---|
static String |
TRACE_CONTEXT_MAP_KEY |
static String |
TRACE_ID |
static String |
TRACE_TRANSACTION_ID |
| Modifier and Type | Method and Description |
|---|---|
void |
addProcessorSpan(String transactionId,
String location,
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 void |
endProcessorSpan(String transactionId,
String location,
Consumer<io.opentelemetry.api.trace.Span> spanUpdater)
End an existing span under an existing transaction.
|
void |
endProcessorSpan(String transactionId,
String location,
Consumer<io.opentelemetry.api.trace.Span> 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.
|
void |
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
|
io.opentelemetry.context.Context |
getTransactionContext(String transactionId)
Get the
Context of the initiating flow span. |
void |
startTransaction(String transactionId,
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_ID
default String transactionIdFor(org.mule.runtime.api.event.Event muleEvent)
muleEvent - EventString transaction idvoid startTransaction(String transactionId, String rootFlowName, io.opentelemetry.api.trace.SpanBuilder rootFlowSpan)
transactionId - A unique transaction id within the context of an application. Eg.
Correlation id.rootFlowName - 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)
io.opentelemetry.context.Context getTransactionContext(String transactionId)
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.ContextString 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.void 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 transactionId, String location, io.opentelemetry.api.trace.SpanBuilder spanBuilder)
transactionId - location - spanBuilder - default void endProcessorSpan(String transactionId, String location)
transactionId - location - default void endProcessorSpan(String transactionId, String location, 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 - location - spanUpdater - Consumer to allow updating Span before ending.void endProcessorSpan(String transactionId, String location, Consumer<io.opentelemetry.api.trace.Span> spanUpdater, Instant endTime)
endProcessorSpan(String,
String, Consumer).transactionId - location - spanUpdater - endTime - Copyright © 2022 AVIO Consulting. All rights reserved.