Skip to content

Commit d295505

Browse files
committed
breaking(transport): Make HTTP2Transport the default
1 parent 43348e9 commit d295505

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sentry_sdk/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class CompressionAlgo(Enum):
6969
"transport_compression_level": Optional[int],
7070
"transport_compression_algo": Optional[CompressionAlgo],
7171
"transport_num_pools": Optional[int],
72-
"transport_http2": Optional[bool],
7372
"enable_logs": Optional[bool],
7473
"before_send_log": Optional[Callable[[Log, Hint], Optional[Log]]],
7574
},
@@ -662,6 +661,7 @@ def __init__(
662661
custom_repr=None, # type: Optional[Callable[..., Optional[str]]]
663662
add_full_stack=DEFAULT_ADD_FULL_STACK, # type: bool
664663
max_stack_frames=DEFAULT_MAX_STACK_FRAMES, # type: Optional[int]
664+
http2=None, # type: Optional[bool]
665665
):
666666
# type: (...) -> None
667667
"""Initialize the Sentry SDK with the given parameters. All parameters described here can be used in a call to `sentry_sdk.init()`.

sentry_sdk/transport.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,12 @@ def make_transport(options):
803803
# type: (Dict[str, Any]) -> Optional[Transport]
804804
ref_transport = options["transport"]
805805

806-
use_http2_transport = options.get("_experiments", {}).get("transport_http2", False)
806+
# We default to using HTTP2 transport if the user also has the required h2
807+
# library installed (through the subclass check). The reason is h2 not being
808+
# available on py3.7 which we still support.
809+
use_http2_transport = options.get("http2", True) and not issubclass(
810+
Http2Transport, HttpTransport
811+
)
807812

808813
# By default, we use the http transport class
809814
transport_cls = (

0 commit comments

Comments
 (0)