Skip to content

Commit 76c1b9e

Browse files
feat: Attach server.address to metrics
1 parent c4d0ba8 commit 76c1b9e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sentry_sdk/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,13 @@ def _capture_metric(self, metric):
10061006
metric["attributes"]["sentry.sdk.name"] = SDK_INFO["name"]
10071007
metric["attributes"]["sentry.sdk.version"] = SDK_INFO["version"]
10081008

1009+
server_name = self.options.get("server_name")
1010+
if (
1011+
server_name is not None
1012+
and SPANDATA.SERVER_ADDRESS not in metric["attributes"]
1013+
):
1014+
metric["attributes"][SPANDATA.SERVER_ADDRESS] = server_name
1015+
10091016
environment = self.options.get("environment")
10101017
if environment is not None and "sentry.environment" not in metric["attributes"]:
10111018
metric["attributes"]["sentry.environment"] = environment

0 commit comments

Comments
 (0)