Filter on url in GCP lots and all my prisma SQL dissapears!!!
This is a plea for prisma to please log on the thread of execution as asyncLocalStorage is used by devops teams so they can filter on requestId or url especially when we get a complaint on a specific request id. all logs EXCEPT our prisma logs come out looking like the 2nd picture and we can filter on ANY of those with a simple right click but only 3rd party library that logs wrong seems to be prisma. We have this code and if the $on ran on the thread that ran the SQL, it would be much better for devops to pinpoint issues -> const prismaClient = new PrismaClient({
datasources: {
db: {
url: databaseUrl,
},
},
log: [
{
emit: 'event', // This setting enables logging via event emitters
level: 'query', // Logs SQL queries
}
],
})
// Example: Using event-based logging
prismaClient.$on('query', (e) => {
logger.info(
SQL Query Duration: ${e.duration}ms SQL:${e.query} Params: ${e.params}
);
});
myContainer.bind<PrismaClient>(TYPES.PrismaClient).toConstantValue(prismaClient);
6 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai
channel awaits if you're curious!oops, 2nd picture here

1st picture is me filtering on a url and all my SQL logs dissappear and should not. It should filter to ONLY the ones that service that request.
GitHub
When filtering on logs in GCP for a url or request id, prisma logs ...
Many servers use asyncLocalStorage so in GCP, they can do this and filter on a single requestId (or url or whatever) but notice the prisma SQL logs dissappear... The code we have for prisma creatio...
Thank you for creating the issue. Our engineering team will take a look.