Tracing module enables you to enhance your logs by adding, removing, and clearing variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution.
Operations
Clear Logging Variables
<clear-logging-variables>
Clears all the logging variables from the event logging context. This operation does not remove the correlation ID nor the current event processor because those variables are managed by Mule runtime engine.
Remove Logging Variables
<remove-logging-variable>
Removes a variable from the event logging context.
Set Logging Variables
<set-logging-variable>
Sets a new logging variable and its value. The new variable is present in the next operation execution for the event.
Parameters
| Name | Type | Description | Default Value | Required |
|---|---|---|---|---|
Name |
String |
Display name for the operation. |
||
Variable name |
String |
Name of the variable to log. |
x |
|
Value |
String |
Value to assign to the variable. Accepts DataWeave expressions. |
x |
| When OpenTelemetry tracing is enabled, the variable set by this operation is also added as an attribute of the span that represents the operation and of the spans and log records generated during the rest of the flow’s execution, including subflows, flow references, and error handlers. |
Add Root Span Attributes
<add-root-span-attributes>
Adds custom attributes to the current transaction’s root (server) span, regardless of how deeply nested the calling flow is. Use this operation to attach transaction-level fields, such as a client ID or conversation ID, to the primary span instead of a child span.
| This operation requires Mule runtime engine 4.13 or later. On earlier runtimes, it is a no-op. |
Scopes
With CorrelationID
<with-correlation-id>
Scope that runs the inner chain with the given correlation ID. After the inner chain finishes executing, the correlation ID returns to the previous one.
Parameters
| Name | Type | Description | Default Value | Required |
|---|---|---|---|---|
Name |
String |
Display name for the scope |
||
Correlation id |
String |
Set a custom correlation ID. |
x |
|
Target Variable |
String |
Name of the variable that stores the operation’s output. |
||
Target Value |
String |
Expression that evaluates the operation’s output. The expression outcome is stored in the target variable. |
#[payload] |