Requirements

Agent version 2.88.0.72 or higher.

Description

message_transaction (and its associated calls) report message functions as transactions. message_trace is used to add more detail to your transaction traces in the form of additional segments. message_trace returns a partial of MessageTraceWrapper that can be used as a decorator for a message function.

The message_trace decorator can be used on generators and coroutines with agent version 2.102.0.85 or higher. Timing of these objects begins when consumption starts, and ends when the object is exhausted or goes out of scope. This is a change from earlier versions where the metric represented the time taken to create the generator or coroutine object itself.

If you cannot use the decorator in your application, you can use one of these other call formats:

The context manager: The context manager form is MessageTrace. It takes the same parameters as the decorator.

The wrapper: The wrapper form is MessageTraceWrapper. It can be used to return a wrapped function without the use of a decorator.

The path-based wrapper: The path-based wrapper form is wrap_message_trace. This applies the MessageTraceWrapper to a given object through monkey patching. This takes the same parameters as the decorator plus an additional module and object_path parameter.