Set up tracing
Set up LLM tracing with tracely.
For an end-to-end example, check the Tracing Quickstart.
Installation and Imports
Install the tracely
package from PyPi.
Imports:
Initialize tracing
Use init_tracing
to enable tracely tracing. Example:
Tracing parameters
Parameter | Description |
| The URL of the collector service where tracing data will be sent. For Evidently Cloud, set |
| Specifies the type of exporter to use for tracing. Options are |
| The authorization API key for Evidently Cloud tracing. This key authenticates your requests and is necessary for sending data to Evidently Cloud.
Required: No, Default: |
| The ID of your Project in Evidently Cloud.
Required: Yes, Default: |
| A string name assigned to the exported tracing data. All data with the same |
| Indicates whether to register the tracing provider globally for OpenTelemetry ( |
Tracing a function
To trace a function call use trace_event()
decorator.
Example 1. To log all arguments of the function:
Example 2. To log only input arguments of the function:
Example 3. To log only "arg1" and "arg2":
See the Tracing Quickstart for an end-to-end example.
Parameter | Description |
| The name of the span to track. This is how the event will be labeled in the trace. By giving it a name, you can identify and analyze this particular step within your tracing data.
Required: No, Default: |
| A list of arguments to capture during tracing. If set to |
| A list of arguments to ignore from tracking. For instance, if a function has sensitive information that you don’t want to log, you can list those arguments here. If set to |
| Indicates whether to track the output of the function call. If set to |
Last updated