feat(clickhouse_driver): Support span streaming#6508
feat(clickhouse_driver): Support span streaming#6508alexander-alderman-webb wants to merge 5 commits into
Conversation
Codecov Results 📊✅ 88791 passed | ⏭️ 6025 skipped | Total: 94816 | Pass Rate: 93.65% | Execution Time: 291m 24s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 91.89%. Project has 2357 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.90% 89.90% —%
==========================================
Files 192 192 —
Lines 23321 23340 +19
Branches 8020 8030 +10
==========================================
+ Hits 20967 20983 +16
- Misses 2354 2357 +3
- Partials 1326 1328 +2Generated by Codecov Action |
sentrivana
left a comment
There was a problem hiding this comment.
See comments, feels like we could migrate more data to attributes?
|
|
||
|
|
||
| def _wrap_start(f: "Callable[P, T]") -> "Callable[P, T]": | ||
| @ensure_integration_enabled(ClickhouseDriverIntegration, f) |
There was a problem hiding this comment.
IIRC the decorator also wraps the decorated func in functools.wraps(), so we should add that here manually
There was a problem hiding this comment.
yes, a few other integrations are also affected so I'll go ahead and update them as well. 30ffaad
| ) | ||
|
|
||
| connection._sentry_span = span # type: ignore[attr-defined] | ||
| span.set_data("query", query) |
There was a problem hiding this comment.
There was a problem hiding this comment.
db.query.text should have placeholders according to the description, and the query passed to Connection.send_query already contains substituted values.
You can observe this in the tests for the span descriptions (there are no assertions on the query attribute):
| if params and should_send_default_pii(): | ||
| span.set_data("db.params", params) |
There was a problem hiding this comment.
There was a problem hiding this comment.
We didn't add the attribute in SQLAlchemy because it was unclear how parameters for batched queries are reported. The same applies to this driver.
Description
In the streaming path, use
db.namespaceinstead ofdb.namedb.system.nameinstead ofdb.systemDropped attributes:
db.paramsdb.resultquerydb.query_idTests for adding breadcrumbs based on spans have not been parametrized as breadcrumbs are not automatically created from spans with the new streaming lifecycle.
Adapting Tests
sed commands used for converting transaction context managers:
sed commands used for converting event capture:
sed commands used for converting
op:sed commands used for converting origin:
sed commands used for converting description:
sed -i '' 's/"description"/"name"/g'
sed commands used for converting data to attributes:
sed commands used for converting timestamps:
other test changes:
Issues
Closes #6011
Reminders
uv run ruff.feat:,fix:,ref:,meta:)