Skip to content

Commit cd22cbd

Browse files
committed
more fixes
1 parent 66cb16a commit cd22cbd

File tree

3 files changed

+118
-60
lines changed

3 files changed

+118
-60
lines changed

MIGRATION_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
1818
- A `Profile` object does not have a `.hub` property anymore.
1919
- `sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager.
2020
- Redis integration: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).
21+
- clickhouse-driver integration: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
2122

2223
### Removed
2324

sentry_sdk/integrations/clickhouse_driver.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ def _inner(*args: P.args, **kwargs: P.kwargs) -> T:
9191

9292
_set_db_data(span, connection)
9393

94-
span.set_data("db.query.text", query)
94+
if should_send_default_pii():
95+
span.set_data("db.query.text", query)
9596

9697
if query_id:
9798
span.set_data("db.query_id", query_id)
9899

99100
if params and should_send_default_pii():
100-
span.set_data("db.params", params)
101+
span.set_data("db.params", str(params))
101102

102103
# run the original code
103104
ret = f(*args, **kwargs)
@@ -115,24 +116,24 @@ def _inner_end(*args: P.args, **kwargs: P.kwargs) -> T:
115116

116117
if span is not None:
117118
if res is not None and should_send_default_pii():
118-
span.set_data("db.result", res)
119+
span.set_data("db.result", str(res))
119120

120121
with capture_internal_exceptions():
121122
query = span.get_attribute("db.query.text")
122-
data = {}
123-
for attr in (
124-
"db.query_id",
125-
"db.params",
126-
"db.result",
127-
"db.system",
128-
"db.user",
129-
"server.address",
130-
"server.port",
131-
):
132-
if span.get_attribute(attr):
133-
data[attr] = span.get_attribute(attr)
134-
135123
if query:
124+
data = {}
125+
for attr in (
126+
"db.query_id",
127+
"db.params",
128+
"db.result",
129+
"db.system",
130+
"db.user",
131+
"server.address",
132+
"server.port",
133+
):
134+
if span.get_attribute(attr):
135+
data[attr] = span.get_attribute(attr)
136+
136137
sentry_sdk.add_breadcrumb(
137138
message=query, category="query", data=data
138139
)

0 commit comments

Comments
 (0)