Performance Analysis for Trpc api

Hey 👋 , I have been facing performance bottlnecks in some of my APIs, I used to code in django before, I used gprof2dot to profile apis, Is there a similar tool for trpc?
12 Replies
Neto
Neto•2mo ago
what is exactly slow?
nate_ak_
nate_ak_•2mo ago
the api endpoints take couple of seconds to load, and there are so many function calls happening in the routes, need a tool which show flow map with timings of execution of each functions etc
Neto
Neto•2mo ago
add tracing
Neto
Neto•2mo ago
Axiom
Stop sampling, observe every event – Axiom
100% of your data for every possible need: o11y, security, analytics, and new insights.
Neto
Neto•2mo ago
most likely it would be two separate instances that are called together @cje does axiom play nice with trpc?
nate_ak_
nate_ak_•2mo ago
thank you will check this out!
Neto
Neto•2mo ago
you can get something like this
No description
cje
cje•2mo ago
What do you mean by "play nice with tRPC"? If you don't want to setup OTel tracing, we have an example for the next-axiom library with tRPC https://github.com/axiomhq/next-axiom/tree/main/examples/trpc-app-router you could modify the middleware to console.time or similar before/after the procedure to get info on how long it takes to run. https://github.com/axiomhq/next-axiom/blob/main/examples/trpc-app-router/src/server/api/axiom-trpc.ts If you do want to setup OTel tracing, that works as well (see attached screenshot from my side project), although OTel + Next.js, especially app dir, is kind of a mess.
No description
Neto
Neto•2mo ago
bad wording on my part
nate_ak_
nate_ak_•2mo ago
thanks cje, this was helpful ! never used Otel before, will integrate it to my app I use page router and not the new one, soI think Otel+nextjs shouldnt be a mess
Neto
Neto•2mo ago
just don't use the vercel integration
nate_ak_
nate_ak_•2mo ago
I have it deployed it on Digital ocean
Want results from more Discord servers?
Add your server