File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 33from tests .test_metrics import envelopes_to_metrics
44
55
6+ def test_top_level_api (sentry_init , capture_envelopes ):
7+ sentry_init ()
8+
9+ envelopes = capture_envelopes ()
10+
11+ sentry_sdk .set_attribute ("set" , "value" )
12+ sentry_sdk .set_attribute ("remove" , "value" )
13+ sentry_sdk .remove_attribute ("removed" , "value" )
14+ # Attempting to remove a nonexistent attribute should not raise
15+ sentry_sdk .remove_attribute ("nonexistent" , "value" )
16+
17+ sentry_sdk .metrics .count ("test" , 1 )
18+ sentry_sdk .get_client ().flush ()
19+
20+ metrics = envelopes_to_metrics (envelopes )
21+ (metric ,) = metrics
22+
23+ assert metric ["attributes" ]["set" ] == "value"
24+ assert "remove" not in metric ["attributes" ]
25+
26+
627def test_scope_precedence (sentry_init , capture_envelopes ):
728 # Order of precedence, from most important to least:
829 # 1. telemetry attributes (directly supplying attributes on creation or using set_attribute)
You can’t perform that action at this time.
0 commit comments