Skip to content

Activity (OpenTelemetry) for DataReader #450

Open
@jods4

Description

@jods4

I would love to have an activity span that starts when a DataReader is created and stops when it's closed, and that includes the number of read rows.

It is useful as fetching/processing can take significant time for some queries. Knowing when ExecuteQuery completed is only a small part of the perf profile. Knowing how many rows a query returns is also quite useful.

If you want some context/inspiration, I had added this myself when I was patching older ODP.NET releases to add ActivitySource into the provider: https://github.com/jods4/OracleApmPatcher/blob/master/Src/Program.cs#L288

I have seen that the DataReader fetches (network round-trips) are instrumented, which is not exactly the same. It could be an alternative, if you add the actual number of rows fetched, and ideally an activity when the reader is closed.

BTW: why do you parse and re-construct SQL text in SpanStart? Why is it not enough/okay to receive the actual text that was executed? This is performed on each query and allocates a lot of strings. I would love an option to get the raw, unprocessed, query text.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions