Skip to content

Commit 8a262ac

Browse files
Merge branch 'master' into szokeasaurusrex/bottle-failed_request_status_codes
2 parents bc561a4 + d34c99a commit 8a262ac

File tree

6 files changed

+179
-96
lines changed

6 files changed

+179
-96
lines changed

requirements-testing.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ pysocks
1313
socksio
1414
httpcore[http2]
1515
setuptools
16+
Brotli

sentry_sdk/consts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class EndpointType(Enum):
1818
ENVELOPE = "envelope"
1919

2020

21+
class CompressionAlgo(Enum):
22+
GZIP = "gzip"
23+
BROTLI = "br"
24+
25+
2126
if TYPE_CHECKING:
2227
import sentry_sdk
2328

@@ -59,6 +64,8 @@ class EndpointType(Enum):
5964
"continuous_profiling_mode": Optional[ContinuousProfilerMode],
6065
"otel_powered_performance": Optional[bool],
6166
"transport_zlib_compression_level": Optional[int],
67+
"transport_compression_level": Optional[int],
68+
"transport_compression_algo": Optional[CompressionAlgo],
6269
"transport_num_pools": Optional[int],
6370
"transport_http2": Optional[bool],
6471
"enable_metrics": Optional[bool],

sentry_sdk/integrations/django/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,18 @@ def _set_db_data(span, cursor_or_db):
717717
connection_params = cursor_or_db.connection.get_dsn_parameters()
718718
else:
719719
try:
720-
# psycopg3
721-
connection_params = cursor_or_db.connection.info.get_parameters()
720+
# psycopg3, only extract needed params as get_parameters
721+
# can be slow because of the additional logic to filter out default
722+
# values
723+
connection_params = {
724+
"dbname": cursor_or_db.connection.info.dbname,
725+
"port": cursor_or_db.connection.info.port,
726+
}
727+
# PGhost returns host or base dir of UNIX socket as an absolute path
728+
# starting with /, use it only when it contains host
729+
pg_host = cursor_or_db.connection.info.host
730+
if pg_host and not pg_host.startswith("/"):
731+
connection_params["host"] = pg_host
722732
except Exception:
723733
connection_params = db.get_connection_params()
724734

0 commit comments

Comments
 (0)