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

Expose query metrics? #29

Open
absolutejam opened this issue Oct 30, 2022 · 0 comments
Open

Expose query metrics? #29

absolutejam opened this issue Oct 30, 2022 · 0 comments

Comments

@absolutejam
Copy link

absolutejam commented Oct 30, 2022

Howdy!

I was curious whether this library or any of the underlying ADO providers provide any metrics around queries that they handle. I mostly opened this for discussion, and to see how feasible it is to get metrics from each provider, or if it's out of scope for this library.

I noticed that this library's queryAsyncSeq leverages Stopwatchs for tracking duration and uses this to log information. I wonder if there's any scope for exposing this information in the consumer-facing API (eg. toAsyncSeqWithMetrics). And then there's the decision on what metrics to expose; how to expose them; if this is feasible for each function (queryAsyncSeq vs queryListSync); and if it's feasible for each provider (SQL Server vs. Postgres).

I checked if Npgsql provides any out-the-box metrics for queries, but it doesn't seem to (it only produces aggregated metrics), and I don't really want to have to instrument my actual query if I can avoid it.

My current solution is to just a wrapper function that tracks the duration of the async with a Stopwatch. This is fine, but more detailed metrics would be nice for use when profiling queries - if this is even possible at this level of abstraction.

Cheers!

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

1 participant