-
Notifications
You must be signed in to change notification settings - Fork 855
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
opencensus inbuilt support #853
Comments
I'm not familiar with opencensus, but after a quick look at there page I think the situation is as follows: You should be able to use As far as using pgx specific functionality such as Once you had a pgx |
Using batched queries is another functionality that cannot be done with database/sql. Could we assist/request a pluggable metrics implementation using opencensus? Since opencensus is used and adopted quite widely, its a shame that you can track everything up to the DB layer and then be left in the dark what and how long is taking when we enter the DB. Another reason why going down to sql.DB is a bad idea is that once again you go back to the text protocol rather than using pgx's binary. Also pgx employs some pretty strong invariants regarding column types in DB being mapped to golang struct types (which is good, but also painful if you've got wrong types in db -> DB has _text, and you try to get it into []UUID, while in fact it wants []string) |
Again, I am unfamiliar with opencensus so I don't know what know what integration with it quite entails, but I can think of two possibilities. pgx has custom logging hooks. It might be that a logger could be implemented that emitted the desired metrics though since it was designed from the perspective of logging not metrics so it may not. Otherwise, I think that wrapping a few core types such as |
https://github.com/opencensus-integrations/ocsql/blob/master/driver.go similar to this, everything is wrapped so it can create spans when you query/exec/ etc. Can we do something like this to be pluggable for pgx? |
That would be the approach of wrapping the pgx types -- and yes I think it is possible. |
Can we open a feature request, or contribute in some way? Do you have any guidelines how exactly should we go about this? |
You can leave this issue open, but I don't know of anyone aside from you who might be planning on working on it.
As I said above, I think the best approach would be to wrap the pgx types. That probably could be done without any pgx modifications. If so, then it probably would make sense as a separate project (or part of opencensus itself). |
@despondency the ocslq lib just wraps the driver. Here is an example on how I register the pgx driver (I am using *sqlx.DB on top of a pgx driver):
|
Wrapping the Would you consider implementing one of:
to allow things like tracers to inspect the behavior of |
If some sort of clean abstraction can be devised that enables this I would be interested in discussing it (and please do discuss before coding), but as I haven't personally needed this functionality I don't have the context or motivation to design or implement it myself. |
Is somebody working on this? Does it make sense to keep this issue open? |
I think the addition of tracing hooks in pgx v5 should enable this integration by a 3rd party. AFAIK, no further changes in pgx are required. |
Currently opencensus (ocsql) works only through sql.DB, however this way we miss on too many features in pgx, could we somehow use pgx, but not need to go lower with sql.DB? Is there any way?
The text was updated successfully, but these errors were encountered: