Skip to content

Expose query metrics? #29

@absolutejam

Description

@absolutejam

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions