oracle / oracle/dotnet-db-samples

Activity (OpenTelemetry) for DataReader

Open
#450 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
434
Forks
191
Avg merge
1d 15h
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the existing DataReader fetch instrumentation and the SpanStart path mentioned in the issue, then compare the linked OracleApmPatcher implementation. Determine whether the change should add a reader-lifetime activity with a row count, improve fetch spans, or expose raw SQL; done means the selected scope is implemented and covered by the relevant existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.