AI features are easy to ship and hard to measure. A chat reply that takes eight seconds, a tool call that quietly fails, or a model bill that doubles after a release can all go unnoticed. Without traces, you only see that users left, not why.
On 9 November 2026, PostHog announced that Firebase Genkit flows can send model, tool and embedding traces to its AI observability product. The integration records tokens, costs, messages and errors, and it redacts credentials. For teams with a mobile app calling a Genkit backend, this connects AI behaviour to product metrics.
Data Points to Track
- flow_name: the Genkit flow that ran
- trace_id: links model, tool and embedding steps
- model_name: model used for the call
- input_tokens: tokens sent
- output_tokens: tokens returned
- cost_usd: estimated cost per flow run
- latency_ms: time from request to final answer
- tool_name: tool the flow called
- tool_status: success or error
- error_type: timeout, rate limit or invalid output
- user_rating: thumbs up or down on the answer
- app_version: client release that triggered the flow
Setup Steps
- Pick one flow to trace first. Choose the one users touch most, such as a support assistant.
- Enable the PostHog integration in your Genkit project and add your project key.
- Pass a distinct ID from the app through to the flow, so traces belong to real users.
- Check redaction. Confirm that keys and secrets do not appear in captured messages.
- Add app events. Send a rating or follow-up event from the app with the same trace ID.
- Set a cost budget. Create an alert for cost per user per day.
- Review a sample of traces by hand each week for quality and surprises.
Actionable Insights
Look at cost per active user, not total spend. A rising figure after a release usually means longer prompts or extra tool loops.
Compare latency with abandonment. If users leave when answers take more than a few seconds, a smaller model or streaming output may help more than a better prompt.
Group errors by tool. A single failing tool often explains most bad answers, and fixing it is faster than retuning the model.
Privacy Notes
Messages can contain personal data. Decide how long traces are kept, tell users how their prompts are used, and mask sensitive fields before they leave your server.
A Simple Rollout Plan
Trace one flow in a test build first, then release to ten percent of users. Compare cost, latency and error rate with the untraced group for a week. Once the numbers are stable, enable tracing for the remaining flows and share the dashboard with product and finance.
Common Mistakes to Avoid
Do not trace every flow at once, since the volume is hard to review. Do not ignore embeddings: they are cheap per call but add up in search features. And do not rely on averages alone. Look at the slowest five percent of runs, because those are the ones users remember.
Related Resources
- Product analytics for linking AI usage to retention
- Documentation for the usage and ingest API
- Services for help measuring AI features