ydb-go-sdk icon indicating copy to clipboard operation
ydb-go-sdk copied to clipboard

feat: split `query.Result` tracing details into Result, ResultSet and Row with scan spans

Open pelageech opened this issue 6 months ago • 0 comments

Feature Request

Describe the Feature Request At the moment, we can either show all spans connected with reading *query.Result or nothing at all. The traces are not satisfactory, too. We can't collapse them into one span in JaegerUI either within in a Result or within a ResultSet.

Describe Preferred Solution I'd like to see my traces in a such span tree:

ReadResult
 ├─ ReadResultSet
 │  ├─ ReadRow
 │  │  └─ ScanRow
 │  ├─ ReadRow
 │  │  └─ ScanRow
 │  ├─ ReadRow
 │  │  └─ ScanRow
 │    ...
 ├─ ReadResultSet
 │
  ...

I think that this is obvious that we should open the span when we get the following ResultSet/Row and an error is nil. But I don't know when to close it (since we don't have any close funcs for ResultSet and Row), so I propose to close the current span when we've called NextResultSet/NextRow before we open the next one. Hope you you'll come up with a better way.

Also, we should close Row, ResultSet and Result spans when we close the Result. We should prevent span leak if result.Close() isn't called as well.

And the second thing is that I would like to remove Result, ResultSet and Row traces individually using trace.Details flags. I think the proper way is to implement the Result flag showing only the Result trace, the ResultSet flag showing Result and ResultSet traces and the Row flag showing the full tree above.

Describe Alternatives

Related Code

Additional Context A quick look at traces: Снимок экрана 2024-08-05 в 12 02 31

If the feature request is approved, would you be willing to submit a PR? No

pelageech avatar Aug 05 '24 04:08 pelageech