Skip to content

Commit f874407

Browse files
authored
fix(metrics): Replace invalid tag values with an empty string instead of _ (#2773)
1 parent 877e47f commit f874407

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sentry_sdk/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
_in_metrics = ContextVar("in_metrics", default=False)
5757
_sanitize_key = partial(re.compile(r"[^a-zA-Z0-9_/.-]+").sub, "_")
58-
_sanitize_value = partial(re.compile(r"[^\w\d_:/@\.{}\[\]$-]+", re.UNICODE).sub, "_")
58+
_sanitize_value = partial(re.compile(r"[^\w\d_:/@\.{}\[\]$-]+", re.UNICODE).sub, "")
5959
_set = set # set is shadowed below
6060

6161
GOOD_TRANSACTION_SOURCES = frozenset(

tests/test_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def test_tag_normalization(
822822

823823
assert len(m) == 3
824824
assert m[0][4] == {
825-
"foo-bar": "_$foo",
825+
"foo-bar": "$foo",
826826
"release": "[email protected]",
827827
"environment": "not-fun-env",
828828
}

0 commit comments

Comments
 (0)