Skip to content
Notifications
Clear all

Showcase: A custom exporter sending Traceloop data to a data warehouse.

2 Posts
2 Users
0 Reactions
0 Views
(@crm_hopper_2025_new)
Reputable Member
Joined: 1 month ago
Posts: 121
Topic starter   [#6476]

Alright, let's talk about something that always gets glossed over: actually *using* your observability data. Traceloop sells a great story on GenAI pipeline monitoring, but then you're stuck inside their dashboard. My sales team needs this data in our warehouse, mixed with pipeline and product usage metrics. The out-of-the-box options felt like an afterthought.

So I built a custom exporter. The goal was simple: pull trace data, especially for LLM calls and tool usage, and land it as structured tables in BigQuery. Not for real-time alerts, but for historical analysis—like correlating poor response times with lost deals.

Here’s the basic flow I cobbled together:
* **Trigger**: A scheduled Cloud Function (10-minute intervals is fine for us).
* **Extraction**: Uses Traceloop’s API (`/v1/traces` endpoint) with filters for the projects I care about. I fetch the span data, focusing on attributes like `llm.model`, `llm.token.count`, `tool.name`, and duration.
* **Transformation**: Flattens the nested JSON into two main tables: one for trace-level info (e.g., `trace_id`, `user_id` from metadata), another for span events (the actual LLM calls/tools).
* **Load**: Pushes directly to BigQuery via its streaming insert API.

The annoying parts, because of course there are some:
* The API's pagination is standard, but you need to manage state carefully between runs to avoid gaps or duplicates.
* Mapping their schema to something anal-retentive like BigQuery requires a lot of data type coercion. Their `attributes` field is a free-for-all.
* Cost control is manual. You have to actively filter by project/environment in your queries, or you'll pull a mountain of irrelevant dev data on their dime (and yours).

The payoff? We can now join LLM cost/latency data against Salesforce opportunity stages. Found a clear link between a specific RAG pipeline slowing down and stalled negotiations. Would've taken weeks to spot that jumping between consoles.

Has anyone else tried to operationalize Traceloop data outside their walls? I'm curious if you went with a batch approach like mine or tried streaming their Webhooks. The Webhook docs looked a bit light for a robust warehouse load.



   
Quote
(@datadog)
Estimable Member
Joined: 1 week ago
Posts: 90
 

Flattening nested spans into two tables is the right call for query performance. One thing that'll bite you later is the API rate limit on `/v1/traces` when you start pulling more projects or shorter intervals. Traceloop doesn't publish hard caps, but I've seen 429s above ~500 requests/min on their standard tier.

You might be better off dumping the raw JSON into a staging table first, then using a scheduled BigQuery script to unwind it. That way you decouple extraction from transformation and can retry failures without losing the data window.

What's your schema for `tool.name`? If you're storing it as a string in the span-events table, you're going to hate yourself the first time a user's custom tool name includes a pipe character.


Metrics don't lie.


   
ReplyQuote