Skip to content

pg instrumentation doesn't work with Promise based API #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wmonk opened this issue Jan 22, 2021 · 3 comments
Closed

pg instrumentation doesn't work with Promise based API #297

wmonk opened this issue Jan 22, 2021 · 3 comments

Comments

@wmonk
Copy link

wmonk commented Jan 22, 2021

The title says it all really, the instrumentation added to Client.prototype.query for the pg does not handle the Promise based API that is exposed. Happy to open a PR for this if wanted.

A feature for this that I noticed in our own sub-optimal usage of the library would be to instrument the part of the code that waits for a connection from db server / connection pool. We are using lambda without the AWS connection pool offering, so just grab a fresh connection each time. So when you look at the trace in Honeycomb UI, it has whitespace at the point where (I'm guessing) it's waiting for a connection. I would guess that if your db server / connection pool is exhausted, it would cause some amount of latency that would not be covered in your trace -- I might be wrong here though.

@joerayme
Copy link

I think we might be encountering the same problem—some of our queries do seem to be appearing in the traces (mostly transaction queries i.e. BEGIN and ROLLBACK/COMMIT), but the actual query within the transaction often doesn't appear (although it's not consistent—some of them do seem to and I can't figure out what's different between them).

I've narrowed my particular problem down to this line in pg.js—when the query isn't traced, this is what seems to be happening. From my understanding of what's going on in traceActive() this seems to match up with the original report that it's something to do with the async nature of the API.

Is there a workaround/fix for this?

@joerayme
Copy link

joerayme commented Aug 3, 2021

Just in case anyone else is having the same problem, I've found that it's probably related to this bug and is fixed in Node 14.5.0—I've verified that updating to that version does seem to fix the problem, at least in my repro app. Now to upgrade our APIs...

@vreynolds
Copy link
Contributor

Hello,

We will be closing this issue as it is a low priority for us. It is unlikely that we'll ever get to it, and so we'd like to set expectations accordingly.

As we enter 2022 Q1, we are trimming our OSS backlog. This is so that we can focus better on areas that are more aligned with the OpenTelemetry-focused direction of telemetry ingest for Honeycomb.

If this issue is important to you, please feel free to ping here and we can discuss/re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants