Skip to content

Commit 906879f

Browse files
fix(boto3): remove space from service_id and span names (#7955)
### Description Remove whitespace from services whose `service_id` contain spaces; since span names are formed using `str(service_id)` they are incorrect: * `service_id = "API Gateway"` => `service_id= "API Gateway"` * `span_name = "API Gateway.GetRestApis"` => `span_name = "APIGateway.GetRestApis"` #### Issues Resolves #7954
1 parent c27c69a commit 906879f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎sentry_sdk/integrations/boto3/_context.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def add_metadata(self, client: "BaseClient") -> None:
3838
# botocore's internal identifier, e.g. `apigateway`.
3939
self.service_name = service_model.service_name
4040
service_id = service_model.service_id
41-
# modeled AWS service identity used in span names, e.g. `API Gateway`.
42-
self.service_id = str(service_id)
41+
# modeled AWS service identity used in span names with whitespace stripped, e.g. `API Gateway` => `APIGateway`.
42+
self.service_id = "".join(str(service_id).split())
4343
self.service_id_hyphenized = service_id.hyphenize()
4444

4545
with capture_internal_exceptions():

‎tests/integrations/boto3/test_client.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ def get_response_attributes(self, ctx, response):
540540
"apigateway",
541541
"get_rest_apis",
542542
{},
543-
"API Gateway.GetRestApis",
544-
"API Gateway",
543+
"APIGateway.GetRestApis",
544+
"APIGateway",
545545
"GetRestApis",
546546
None,
547547
"apigateway.eu-north-1.amazonaws.com",

0 commit comments

Comments
 (0)