Skip to content
Notifications
Clear all

Help: how to bulk delete test traces from the UI?

3 Posts
3 Users
0 Reactions
0 Views
(@elenab)
Eminent Member
Joined: 2 weeks ago
Posts: 34
Topic starter   [#22795]

I’ve been evaluating Langfuse for a few weeks now, instrumenting a couple of our internal services to track prompt chains and trace costs. As expected, the initial phase generated a mountain of test data—erroneous traces, duplicate runs, and the general detritus that comes from debugging integration code. Now I’m trying to clean up the project before we move to a more serious staging phase, and I’ve hit a wall.

The UI is pleasant enough for poking at individual traces, but it seems utterly oblivious to the concept of bulk operations. I have several thousand traces tagged with “test” or “debug” across a handful of different sessions. Clicking the delete button on each one is, to put it mildly, a non-starter. The documentation is curiously silent on this, dancing around data management with talk of observability and insights while ignoring the basic administrative need to prune your own database.

So, my question to the community—and perhaps the Langfuse team lurking here: what is the intended workflow for bulk deletion? I’ve scoured the UI for:

* Any form of multi-select or checkbox mechanism in the traces table.
* A “delete all traces matching filter” option.
* A project-level maintenance or data management panel.

None appear to exist. Am I missing something glaringly obvious, or is this functionality simply absent? If it’s absent, what are the sanctioned alternatives?

I’m aware I could theoretically use the API or SDK to script deletions, but that feels like an unnecessary workaround for what should be a core data hygiene feature. For a platform that charges based on data retention, not offering a straightforward way to manage that data is… perplexing. Before I invest time in writing a cleanup script, I’d like to confirm there isn’t a UI-driven method or an upcoming feature that addresses this. Has anyone else devised a practical method for purging large volumes of test traces without resorting to custom code?


show me the tco


   
Quote
(@cloud_infra_vet)
Reputable Member
Joined: 2 months ago
Posts: 174
 

The UI doesn't offer bulk deletion because the system is built around immutable telemetry. Your operational need is valid, though. You'll need to use the API or the SDK.

For your volume, I'd write a small script using the Python SDK. You can filter traces by tags like "test" and iterate through pages for deletion. It's a one-time cleanup operation. I've done similar data hygiene tasks after PoC phases. Just be careful with your filters; maybe run a count first.

If you're self-hosting, you could handle this directly in the database, but the API is the supported path. The CLI doesn't have a bulk delete command either, so scripting is the way.



   
ReplyQuote
(@annak8)
Trusted Member
Joined: 2 weeks ago
Posts: 47
 

I've gone down that exact Python SDK route and it works, but there's a subtle trap if you're filtering by tags like user1493 mentioned. The pagination with `limit` is straightforward, but you have to be super mindful of the `session_id` filter if you used that during instrumentation.

I'd add one practical caveat to your advice: run the script with `dry_run=True` and just print the trace IDs first for a small batch. I once had a filter that accidentally matched traces from a week prior I wanted to keep. The immutable data model means you can't undo a delete via the API, only a database restore, which is a hassle. 😅

For a one-off, it's fine. But it does make me wish for a simple "archive" or "soft delete" flag for this pre-production phase, so you could hide the test data without nuking it permanently.



   
ReplyQuote