Class InMemoryTransactionStore

  • All Implemented Interfaces:
    TransactionStore

    public class InMemoryTransactionStore
    extends Object
    implements TransactionStore
    In-memory TransactionStore. This implementation uses in-memory Map to store transactions and related processor spans. Transactions are kept in memory until they end.
    • Constructor Detail

      • InMemoryTransactionStore

        public InMemoryTransactionStore()
    • Method Detail

      • startTransaction

        public void startTransaction​(TraceComponent traceComponent,
                                     String rootFlowName,
                                     io.opentelemetry.api.trace.SpanBuilder rootFlowSpanBuilder)
        Description copied from interface: TransactionStore
        Start a new transaction. This usually happens when a new source flow starts. If the transaction with `transactionId` already exists but for different rootFlowName, then it is possible that new rootFlowSpan is a child flow invocation. In that case, span may be added to an existing transaction as a span.
        Specified by:
        startTransaction in interface TransactionStore
        Parameters:
        traceComponent - TraceComponent with tracing information
        rootFlowName - Name of the flow requesting to start transaction.
        rootFlowSpanBuilder - SpanBuilder for building the root span.
      • addTransactionTags

        public void addTransactionTags​(String transactionId,
                                       String tagPrefix,
                                       Map<String,​String> tags)
        Description copied from interface: TransactionStore
        Add custom tags to an existing transaction.
        Specified by:
        addTransactionTags in interface TransactionStore
        Parameters:
        transactionId - A unique transaction id within the context of an application. Eg. Correlation id.
        tagPrefix - String
        tags - Map of String Keys and String Values containing the tags.
      • getTransactionContext

        public TransactionContext getTransactionContext​(String transactionId,
                                                        org.mule.runtime.api.component.location.ComponentLocation componentLocation)
        Description copied from interface: TransactionStore
        Get the Context of the initiating flow span. This may be required to propagate context for a given transaction.
        Specified by:
        getTransactionContext in interface TransactionStore
        Parameters:
        transactionId - A unique transaction id within the context of an application. Eg. Correlation id.
        componentLocation - ComponentLocation
        Returns:
        Context
      • getTraceIdForTransaction

        public String getTraceIdForTransaction​(String transactionId)
        Description copied from interface: TransactionStore
        Get the Trace Id associated the transaction
        Specified by:
        getTraceIdForTransaction in interface TransactionStore
        Parameters:
        transactionId - A unique transaction id within the context of an application. Eg. Correlation id.
        Returns:
        traceId
      • addProcessorSpan

        public void addProcessorSpan​(String containerName,
                                     TraceComponent traceComponent,
                                     io.opentelemetry.api.trace.SpanBuilder spanBuilder)
        Description copied from interface: TransactionStore
        Add a new processor span under an existing transaction.
        Specified by:
        addProcessorSpan in interface TransactionStore
        Parameters:
        containerName - String such as Flow name that contains requested location
        traceComponent - TraceComponent for span
        spanBuilder - SpanBuilder