serverless icon indicating copy to clipboard operation
serverless copied to clipboard

OTEL tracing in driver

Open IAmJSD opened this issue 1 year ago • 2 comments

Support for OpenTelemetry in the serverless driver for transactions/individual queries would be useful to allow for full tracing from request to response of all queries my application is performing

IAmJSD avatar Sep 09 '24 17:09 IAmJSD

I believe you could solve this with a custom fetchFunction, you'd just need to set it up like so:

import { neonConfig, neon } from `@neondatabase/serverless`
neonConfig.fetchFunction = async (url, init) => {
  // pull attrs of the the init object (like from the headers)
  const attrs = {};
  return currentTracer.startActiveSpan(`neon-query`, attrs,  async () => fetch(url, init));
}; 

nicksrandall avatar Sep 11 '24 21:09 nicksrandall

Has PR #102

MatthewAry avatar Apr 22 '25 20:04 MatthewAry