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 , IDENTIFIER , ORIGIN
7+ from sentry_sdk .integrations .boto3 .consts import (
8+ AWS_RPC_SYSTEM_NAME ,
9+ DEFAULT_PORTS ,
10+ IDENTIFIER ,
11+ ORIGIN ,
12+ )
813from sentry_sdk .traces import NoOpStreamedSpan , StreamedSpan
914from sentry_sdk .tracing import BAGGAGE_HEADER_NAME , Span
1015from sentry_sdk .tracing_utils import (
@@ -47,22 +52,17 @@ def _get_server_attributes(endpoint_url: "Optional[str]") -> "Attributes":
4752 if not endpoint_url :
4853 return {}
4954
50- default_ports = {
51- "http" : 80 ,
52- "https" : 443 ,
53- }
54-
5555 try :
5656 parsed_url = urlsplit (endpoint_url )
57- if parsed_url .scheme not in default_ports or not parsed_url .hostname :
57+ if parsed_url .scheme not in DEFAULT_PORTS or not parsed_url .hostname :
5858 return {}
5959
6060 # `server.port` is only defined together with `server.address`.
6161 # Infer the effective port when the configured HTTP(S) endpoint omits it.
6262 # https://opentelemetry.io/docs/specs/semconv/rpc/rpc-spans/
6363 return {
6464 SPANDATA .SERVER_ADDRESS : parsed_url .hostname ,
65- SPANDATA .SERVER_PORT : parsed_url .port or default_ports [parsed_url .scheme ],
65+ SPANDATA .SERVER_PORT : parsed_url .port or DEFAULT_PORTS [parsed_url .scheme ],
6666 }
6767
6868 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