Skip to content
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

Handle pg pool clients #272

Merged
merged 7 commits into from
Jan 4, 2021

Conversation

markgaylard
Copy link
Contributor

We found an issue when calling the promise returning version of query on a pg-pool client. These clients seem to behave a bit differently to both the query method on both pg.Pool and pg.Client. Both of those create a callback function before the the instrumentation is invoked, but in our case, the callback is created after instrumentation. The upshot is that no callback is passed to the query function instrumented by beeline, so even though the spans are started, they are never finished.

This PR adds a wrapper to promises returned by the query function to fix this issue. It also expands on the tests for the pg instrumentation by asserting that the results returned by the wrapped functions are correct. I've also added a bit to the README file to explain how to run the pg tests.

@markgaylard markgaylard requested a review from toshok as a code owner December 23, 2020 06:03
@markgaylard markgaylard requested a review from a team December 23, 2020 06:03
@markgaylard
Copy link
Contributor Author

Not sure why circle ci is sad. Doesn't look like it anything from this PR though.

@MikeGoldsmith
Copy link
Contributor

Thanks for the contribution @markgaylard - we'll review and get back to you ASAP.

I'm not sure why CI failed, it looks to be from an unrelated test that timed out. I've triggered the CI to run again.

Copy link
Contributor

@vreynolds vreynolds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3 the test cases, super helpful! Mostly LGTM, just a couple small asks.

lib/instrumentation/pg.js Outdated Show resolved Hide resolved
lib/instrumentation/pg.js Outdated Show resolved Hide resolved
@vreynolds vreynolds merged commit 43e39da into honeycombio:main Jan 4, 2021
@markgaylard markgaylard deleted the handle-pg-pool-clients branch January 5, 2021 05:54
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

Successfully merging this pull request may close these issues.

3 participants