Posthog analytics on api hotpaths.

Hi, I have an app with many APIs we expose to users (Actually tanstack start serverFns). These APIs are calling downstream APIs from one of our providers. I'd like to get some insight into which of our ServerFns are calling which downstream APIs, and how often. I'm thinking of using Posthog, because I've heard lots about them. I have a wrapper I'm putting at the top of all my ServerFns that checks auth and stuff, so I can easily put a capture({...}) event there, no problem. I also have wrappers for the downstream apis from our provider that I reuse all over the site, I can easily put another capture({...}) in each of those. What I'd like to be done though, tie the capture({...}) at the top of the serverFn to all of the capture({...})s that are done by the downstream apis. So, I'd like to understand which ServerFns are using the most downstream API credits. I'm running everything in lambda, if that makes a difference.
1 Reply
Neto
Neto2w ago
you should use tracing so you can get the qty of executions avg time min, max etc
Want results from more Discord servers?
Add your server