Save and Load Traces
How to manually save and load traces
In addition to persisting to a database, Phoenix allows you to save and load your trace data to and from external files.
Connect to Phoenix
Before accessing px.Client(), be sure you've set the following environment variables:
If you're self-hosting Phoenix, ignore the client headers and change the collector endpoint to your endpoint.
Saving Traces
The initial step involves saving the traces present in a Phoenix instance to a designated location.
Loading Traces
To facilitate the retrieval of these saved traces, one can execute the prescribed commands upon starting Phoenix.
Note the above will save to a default phoenix trace directory, to save in another directory, use the following example below.
Saving Traces to a Specific Directory
You can specify the directory to save your traces by passing adirectory
argument to the save
method.
This output the trace ID and prints the path of the saved file:
💾 Trace dataset saved to under ID: f7733fda-6ad6-4427-a803-55ad2182b662
📂 Trace dataset path: /my_saved_traces/trace_dataset-f7733fda-6ad6-4427-a803-55ad2182b662.parquet
Loading Traces from a Specific Directory
To load the previously saved trace dataset, use the trace ID and the specific directory path where the trace was stored.
NOTE: Make sure to trim down to ONLY the UUID to load. Include path strings for directory only and note to the dataset ID
Last updated