Voyageur
Voyageur
TTCTheo's Typesafe Cult
Created by Voyageur on 2/3/2025 in #questions
Monitoring and scaling management on a multi-application stack
The startup I work with has a couple data crunching applications that fetch and crunch data for our customers who are serviced through our web app. One of these performs dedicated operations for customers, and the other is a shared data store that the first relies on. While rabbit mq would have worked we use kafka, and it plus some http polling handles communication between all three applications. I'm looking at adding monitoring and management of jobs through the entire stack (mainly the two backend applications), do you have any principles, tools or articles you'd recommend for this kind of thing? At a high level I know what we need at the moment, which would be: start and end time of jobs Ability to quarantine or blacklist certain data points However I'm looking for insights about how to structure this, and I'm assuming there are other metrics I should be monitoring but don't know it. We have confluent's dashboard for kafka itself, but this about monitoring our own applications that are being tied together. Right now I'm really struggling with how to isolate this as well. My simplest solution would be adding timings to all the records that we keep which are attached to a specific job and some admin abilities (blacklisting/quarantining jobs on certain data points) but this would require code spread through 3 applications which seems wrong.
2 replies
TTCTheo's Typesafe Cult
Created by Voyageur on 5/10/2023 in #questions
Next-auth and standalone trpc
My team is using nextjs with a standalone trpc server and I'm trying to set up Next-Auth. When I try to run getServerSession on the request in order to add it to my trpc context I'm just receiving null, and I also have a type error coming up:
Argument of type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to parameter of type 'GetServerSessionParams<AuthOptions>'.
Type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to type '[IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }, ServerResponse<IncomingMessage>, AuthOptions]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'IncomingMessage' is not assignable to type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }'.
Property 'cookies' is missing in type 'IncomingMessage' but required in type '{ cookies: Partial<{ [key: string]: string; }>; }'.ts(2345)
Argument of type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to parameter of type 'GetServerSessionParams<AuthOptions>'.
Type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to type '[IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }, ServerResponse<IncomingMessage>, AuthOptions]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'IncomingMessage' is not assignable to type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }'.
Property 'cookies' is missing in type 'IncomingMessage' but required in type '{ cookies: Partial<{ [key: string]: string; }>; }'.ts(2345)
Is it even possible to run next-auth in the standalone server or do I need at least express to parse the request properly? I tried parsing out the cookie and then passing a restructured request into the getServerSession function, but that didn't work.
2 replies
TTCTheo's Typesafe Cult
Created by Voyageur on 4/25/2023 in #questions
Type safety in apollo server
Big fan of t3/trpc but work uses apollo server. Is there any way to incorporate end to end type safety in apollo server?
2 replies