public interface EventTracer<T extends org.mule.runtime.api.event.Event>
Event's.
Once an event is dispatched to a flow, it will hit different components. The processing of an event in each component will
represent a InternalSpan, that is, a unit of work with a start time and an end time that encompasses what each
component does (a http request, a batch job, an until successful block, etc.). In each moment of an event processing, the
Event will have a context span, which is the most specific span associated to that event, that is the most specific
processing that is being done in a certain moment.
Example:
A Event is dispatched to a flow and begins to perform a Http Request. The flow is being processed and also the
http:request, but the current context span is the span corresponding to the http request:
------------- Flow Span -----------------------------------------------------------> |________________ Http Request Span
------- (Current Context Span) ------------>| Modifier and Type | Method and Description |
|---|---|
void |
addCurrentSpanAttribute(T event,
String key,
String value)
Adds an attribute to the current span.
|
void |
addCurrentSpanAttributes(T event,
Map<String,String> attributes)
Adds the attribute to the current span.
|
void |
endCurrentSpan(T event) |
void |
endCurrentSpan(T event,
Assertion condition) |
default Map<String,String> |
getDistributedTraceContextMap(T event) |
SpanSnifferManager |
getSpanExporterManager() |
void |
injectDistributedTraceContext(org.mule.runtime.api.event.EventContext eventContext,
DistributedTraceContextGetter distributedTraceContextGetter)
Injects a distributedTraceContext in a
InternalSpan |
default void |
recordErrorAtCurrentSpan(T event,
boolean isErrorEscapingCurrentSpan)
Records an error as part of the current
InternalSpan. |
void |
recordErrorAtCurrentSpan(T event,
Supplier<org.mule.runtime.api.message.Error> errorSupplier,
boolean isErrorEscapingCurrentSpan)
Records an error as part of the current
InternalSpan. |
void |
setCurrentSpanName(T event,
String name)
Sets the current span name.
|
Optional<InternalSpan> |
startComponentSpan(T event,
InitialSpanInfo spanInfo)
Starts a span associated to the as the current context span for the
Event. |
Optional<InternalSpan> |
startComponentSpan(T event,
InitialSpanInfo spanInfo,
Assertion assertion)
Starts a span associated to the as the current context span for the
Event. |
Optional<InternalSpan> startComponentSpan(T event, InitialSpanInfo spanInfo)
Event.event - the Event that has hit the ComponentspanInfo - the InitialSpanInfo used for customizing the span.Event when it hits the if it could be created.Optional<InternalSpan> startComponentSpan(T event, InitialSpanInfo spanInfo, Assertion assertion)
Event.event - the Event that has hit the ComponentspanInfo - the InitialSpanInfo used for customizing the span.assertion - indicates a condition that has to be verified for starting the span.Event when it hits the if it could be created.void endCurrentSpan(T event)
event - ends the current context InternalSpan.void endCurrentSpan(T event, Assertion condition)
event - ends the current context InternalSpan.condition - indicates a condition that has to be verified for ending the span.void injectDistributedTraceContext(org.mule.runtime.api.event.EventContext eventContext,
DistributedTraceContextGetter distributedTraceContextGetter)
InternalSpaneventContext - the EventContext to inject.distributedTraceContextGetter - the DistributedTraceContextGetter to get the distributed trace context.default void recordErrorAtCurrentSpan(T event, boolean isErrorEscapingCurrentSpan)
InternalSpan.event - The event to retrieve the distributed trace context from. Must contain the
Error to be recorded.isErrorEscapingCurrentSpan - True if the error is not being handled as part of the execution of the work that the
InternalSpan containing the error represents.void recordErrorAtCurrentSpan(T event, Supplier<org.mule.runtime.api.message.Error> errorSupplier, boolean isErrorEscapingCurrentSpan)
InternalSpan.event - The event to retrieve the distributed trace context from.errorSupplier - Supplier of the Error that occurred.isErrorEscapingCurrentSpan - True if the error is not being handled as part of the execution of the work that the
InternalSpan containing the error represents.default Map<String,String> getDistributedTraceContextMap(T event)
event - The event to retrieve the distributed trace context from.void setCurrentSpanName(T event, String name)
event - the Event to set the name to.name - the name to set.void addCurrentSpanAttribute(T event, String key, String value)
event - the event to add the attribute to.key - the key for the span attributevalue - the value for the span attributevoid addCurrentSpanAttributes(T event, Map<String,String> attributes)
event - the event to add the attribute to.attributes - a map with the attributes to add.SpanSnifferManager getSpanExporterManager()
SpanSnifferManager.Copyright © 2003–2023 MuleSoft, Inc.. All rights reserved.