File tree Expand file tree Collapse file tree
sentry_sdk/integrations/boto3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import sentry_sdk
55from sentry_sdk .consts import OP , SPANDATA , SPANSTATUS
66from sentry_sdk .integrations import DidNotEnable
7- from sentry_sdk .integrations .boto3 .consts import AWS_RPC_SYSTEM_NAME , ORIGIN
7+ from sentry_sdk .integrations .boto3 .consts import (
8+ AWS_RPC_SYSTEM_NAME ,
9+ DEFAULT_PORTS ,
10+ ORIGIN ,
11+ )
812from sentry_sdk .traces import NoOpStreamedSpan , StreamedSpan
913from sentry_sdk .tracing import BAGGAGE_HEADER_NAME , Span
1014from sentry_sdk .tracing_utils import (
@@ -47,22 +51,17 @@ def _get_server_attributes(endpoint_url: "Optional[str]") -> "Attributes":
4751 if not endpoint_url :
4852 return {}
4953
50- default_ports = {
51- "http" : 80 ,
52- "https" : 443 ,
53- }
54-
5554 try :
5655 parsed_url = urlsplit (endpoint_url )
57- if parsed_url .scheme not in default_ports or not parsed_url .hostname :
56+ if parsed_url .scheme not in DEFAULT_PORTS or not parsed_url .hostname :
5857 return {}
5958
6059 # `server.port` is only defined together with `server.address`.
6160 # Infer the effective port when the configured HTTP(S) endpoint omits it.
6261 # https://opentelemetry.io/docs/specs/semconv/rpc/rpc-spans/
6362 return {
6463 SPANDATA .SERVER_ADDRESS : parsed_url .hostname ,
65- SPANDATA .SERVER_PORT : parsed_url .port or default_ports [parsed_url .scheme ],
64+ SPANDATA .SERVER_PORT : parsed_url .port or DEFAULT_PORTS [parsed_url .scheme ],
6665 }
6766
6867 except (TypeError , UnicodeError , ValueError ):
Original file line number Diff line number Diff line change 44# value is used by `rpc.system` (deprecated in OTel, but we still support it for now) and `rpc.system.name`
55# https://opentelemetry.io/docs/specs/semconv/cloud-providers/aws-sdk/#aws-sdk-spans
66AWS_RPC_SYSTEM_NAME = "aws-api"
7+
8+ # default ports for HTTP and HTTPS
9+ DEFAULT_PORTS = {
10+ "http" : 80 ,
11+ "https" : 443 ,
12+ }
You can’t perform that action at this time.
0 commit comments