openzipkin / zipkin-js

Zipkin instrumentation for Node.js and browsers
Apache License 2.0
565 stars 171 forks source link

Using the Zipkin Postgres with sequelize #455

Open saasen opened 4 years ago

saasen commented 4 years ago

We would love to use the zipkin-instrumentation-postgres package for tracing our Postgres calls. However, we are using an ORM which is called sequelize. This wraps the client, so the client is not available to be wrapped by the zipkin Postgres package. How would one do this? I have found an issue which kind of explains what I'm trying to do: https://github.com/openzipkin/zipkin-js/issues/227. It seems like sequelize can use CLS, although I'm unsure for what reason. I guess only for passing the transaction around without manually doing it.

Do you know any way to make this work without writing our own zipkin instrumentation for sequelize?

jcchavezs commented 4 years ago

Hi @saasen I had a look at the documentation (not an expert tho) and it seems the best option is to use https://sequelize.org/master/manual/hooks.html by wrapping the instance?. Are you up to take a shot on this with a PR? I can help with the review.