Skip to content

Commit 3148c74

Browse files
test
1 parent 76c1b9e commit 3148c74

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_metrics.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sentry_sdk import get_client
88
from sentry_sdk.envelope import Envelope
99
from sentry_sdk.types import Metric
10+
from sentry_sdk.consts import SPANDATA, VERSION
1011

1112

1213
def envelopes_to_metrics(envelopes):
@@ -93,7 +94,7 @@ def test_metrics_experimental_option(sentry_init, capture_envelopes):
9394

9495

9596
def test_metrics_with_attributes(sentry_init, capture_envelopes):
96-
sentry_init(release="1.0.0", environment="test")
97+
sentry_init(release="1.0.0", environment="test", server_name="test-server")
9798
envelopes = capture_envelopes()
9899

99100
sentry_sdk.metrics.count(
@@ -110,6 +111,10 @@ def test_metrics_with_attributes(sentry_init, capture_envelopes):
110111
assert metrics[0]["attributes"]["sentry.release"] == "1.0.0"
111112
assert metrics[0]["attributes"]["sentry.environment"] == "test"
112113

114+
assert metrics[0]["attributes"][SPANDATA.SERVER_ADDRESS] == "test-server"
115+
assert metrics[0]["attributes"]["sentry.sdk.name"].startswith("sentry.python")
116+
assert metrics[0]["attributes"]["sentry.sdk.version"] == VERSION
117+
113118

114119
def test_metrics_with_user(sentry_init, capture_envelopes):
115120
sentry_init()

0 commit comments

Comments
 (0)