Skip to content

Commit 35a9a72

Browse files
committed
Merge branch 'potel-base' into srothh/complete-async-transport
2 parents c44e671 + c27ac1f commit 35a9a72

25 files changed

+100
-176
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## 3.0.0a4
4+
5+
### Various fixes & improvements
6+
7+
- Migrate more type comments to annotations (#4651) by @sl0thentr0py
8+
- ref: Drop experimental logs options in 3.0 (#4653) by @sl0thentr0py
9+
- Polish migration guide (#4650) by @sl0thentr0py
10+
- Add `enable_logs`, `before_send_log` as top-level options (#4644) by @sentrivana
11+
- Add missing return type annotation (#3152) by @sl0thentr0py
12+
- Fix mypy (#4649) by @sentrivana
13+
- Better checking for empty tools list (#4647) by @antonpirker
14+
- ref: Remove `MAX_EVENT_BYTES` (#4630) by @sl0thentr0py
15+
- update changelog (9276f2a1) by @antonpirker
16+
- release: 2.34.1 (a71ef66d) by @getsentry-bot
17+
- typing (#3152) by @sl0thentr0py
18+
- Update tests (#3152) by @sl0thentr0py
19+
- Span data is always be a primitive data type (#4643) by @antonpirker
20+
- Fix typo in CHANGELOG.md (#4640) by @jgillard
21+
- updated test matrix (#3152) by @sl0thentr0py
22+
- Add new_trace api to force a new trace (#4642) by @sl0thentr0py
23+
- Revert "Add new_trace api to force a new trace" (#3152) by @sl0thentr0py
24+
- Add new_trace api to force a new trace (#3152) by @sl0thentr0py
25+
- Update changelog (72766a79) by @antonpirker
26+
- Update CHANGELOG.md (e1848d4f) by @sentrivana
27+
- release: 2.34.0 (e84f6f30) by @getsentry-bot
28+
- Considerably raise `DEFAULT_MAX_VALUE_LENGTH` (#4632) by @sentrivana
29+
- fix(celery): Latency should be in milliseconds, not seconds (#4637) by @sentrivana
30+
- OpenAI integration update (#4612) by @antonpirker
31+
32+
_Plus 16 more_
33+
334
## 3.0.0a3
435

536
We're excited to announce that version 3.0 of the Sentry Python SDK is now

MIGRATION_GUIDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
4040
- `MAX_PROFILE_DURATION_NS`, `PROFILE_MINIMUM_SAMPLES`, `Profile`, `Scheduler`, `ThreadScheduler`, `GeventScheduler`, `has_profiling_enabled`, `setup_profiler`, `teardown_profiler` are no longer accessible from `sentry_sdk.profiler`. They're still accessible from `sentry_sdk.profiler.transaction_profiler`.
4141
- `DEFAULT_SAMPLING_FREQUENCY`, `MAX_STACK_DEPTH`, `get_frame_name`, `extract_frame`, `extract_stack`, `frame_id` are no longer accessible from `sentry_sdk.profiler`. They're still accessible from `sentry_sdk.profiler.utils`.
4242

43+
#### Logs
44+
45+
- `enable_logs` and `before_send_log` are now regular SDK options. Their original versions under `_experiments` have been removed.
4346

4447
#### Integrations
4548
- Redis: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
3434
author = "Sentry Team and Contributors"
3535

36-
release = "3.0.0a3"
36+
release = "3.0.0a4"
3737
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3838

3939

scripts/build_aws_lambda_layer.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import subprocess
44
import sys
55
import tempfile
6-
from typing import TYPE_CHECKING
6+
from typing import Optional
77

88
from sentry_sdk.consts import VERSION as SDK_VERSION
99

10-
if TYPE_CHECKING:
11-
from typing import Optional
1210

1311
DIST_PATH = "dist" # created by "make dist" that is called by "make aws-lambda-layer"
1412
PYTHON_SITE_PACKAGES = "python" # see https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path
@@ -17,10 +15,9 @@
1715
class LayerBuilder:
1816
def __init__(
1917
self,
20-
base_dir, # type: str
21-
out_zip_filename=None, # type: Optional[str]
22-
):
23-
# type: (...) -> None
18+
base_dir: str,
19+
out_zip_filename: Optional[str] = None,
20+
) -> None:
2421
self.base_dir = base_dir
2522
self.python_site_packages = os.path.join(self.base_dir, PYTHON_SITE_PACKAGES)
2623
self.out_zip_filename = (
@@ -29,12 +26,10 @@ def __init__(
2926
else out_zip_filename
3027
)
3128

32-
def make_directories(self):
33-
# type: (...) -> None
29+
def make_directories(self) -> None:
3430
os.makedirs(self.python_site_packages)
3531

36-
def install_python_packages(self):
37-
# type: (...) -> None
32+
def install_python_packages(self) -> None:
3833
# Install requirements for Lambda Layer (these are more limited than the SDK requirements,
3934
# because Lambda does not support the newest versions of some packages)
4035
subprocess.check_call(
@@ -68,8 +63,7 @@ def install_python_packages(self):
6863
check=True,
6964
)
7065

71-
def create_init_serverless_sdk_package(self):
72-
# type: (...) -> None
66+
def create_init_serverless_sdk_package(self) -> None:
7367
"""
7468
Method that creates the init_serverless_sdk pkg in the
7569
sentry-python-serverless zip
@@ -84,8 +78,7 @@ def create_init_serverless_sdk_package(self):
8478
"scripts/init_serverless_sdk.py", f"{serverless_sdk_path}/__init__.py"
8579
)
8680

87-
def zip(self):
88-
# type: (...) -> None
81+
def zip(self) -> None:
8982
subprocess.run(
9083
[
9184
"zip",

scripts/init_serverless_sdk.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
import os
1010
import sys
1111
import re
12+
from typing import Any
1213

1314
import sentry_sdk
1415
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
1516

16-
from typing import TYPE_CHECKING
17-
18-
if TYPE_CHECKING:
19-
from typing import Any
20-
2117

2218
# Configure Sentry SDK
2319
sentry_sdk.init(
@@ -70,8 +66,7 @@ def get_lambda_handler(self):
7066
return getattr(self.lambda_function_module, self.handler_name)
7167

7268

73-
def sentry_lambda_handler(event, context):
74-
# type: (Any, Any) -> None
69+
def sentry_lambda_handler(event: Any, context: Any) -> None:
7570
"""
7671
Handler function that invokes a lambda handler which path is defined in
7772
environment variables as "SENTRY_INITIAL_HANDLER"

sentry_sdk/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,5 @@ def end_session() -> None:
339339

340340

341341
@scopemethod
342-
def set_transaction_name(name, source=None):
343-
# type: (str, Optional[str]) -> None
342+
def set_transaction_name(name: str, source: Optional[str] = None) -> None:
344343
return get_current_scope().set_transaction_name(name, source)

sentry_sdk/client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
get_default_release,
2424
handle_in_app,
2525
logger,
26-
get_before_send_log,
27-
has_logs_enabled,
2826
)
2927
from sentry_sdk.serializer import serialize
3028
from sentry_sdk.tracing import trace
@@ -327,7 +325,7 @@ def _capture_envelope(envelope: Envelope) -> None:
327325

328326
self.log_batcher = None
329327

330-
if has_logs_enabled(self.options):
328+
if self.options.get("enable_logs") is True:
331329
from sentry_sdk._log_batcher import LogBatcher
332330

333331
self.log_batcher = LogBatcher(capture_func=_capture_envelope)
@@ -824,7 +822,7 @@ def capture_event(
824822
return return_value
825823

826824
def _capture_experimental_log(self, log: Optional[Log]) -> None:
827-
if not has_logs_enabled(self.options) or log is None:
825+
if self.options.get("enable_logs") is not True or log is None:
828826
return
829827

830828
current_scope = sentry_sdk.get_current_scope()
@@ -879,7 +877,7 @@ def _capture_experimental_log(self, log: Optional[Log]) -> None:
879877
f'[Sentry Logs] [{log.get("severity_text")}] {log.get("body")}'
880878
)
881879

882-
before_send_log = get_before_send_log(self.options)
880+
before_send_log = self.options.get("before_send_log")
883881
if before_send_log is not None:
884882
log = before_send_log(log, {})
885883

sentry_sdk/consts.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ class CompressionAlgo(Enum):
7979
"transport_num_pools": Optional[int],
8080
"transport_http2": Optional[bool],
8181
"transport_async": Optional[bool],
82-
"enable_logs": Optional[bool],
83-
"before_send_log": Optional[Callable[[Log, Hint], Optional[Log]]],
8482
},
8583
total=False,
8684
)
@@ -1275,4 +1273,4 @@ def _get_default_options() -> dict[str, Any]:
12751273
del _get_default_options
12761274

12771275

1278-
VERSION = "3.0.0a3"
1276+
VERSION = "3.0.0a4"

sentry_sdk/integrations/django/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,7 @@ def _set_db_data(span: Span, cursor_or_db: Any) -> None:
712712
span.set_attribute(SPANDATA.SERVER_SOCKET_ADDRESS, server_socket_address)
713713

714714

715-
def add_template_context_repr_sequence():
716-
# type: () -> None
715+
def add_template_context_repr_sequence() -> None:
717716
try:
718717
from django.template.context import BaseContext
719718

sentry_sdk/integrations/logging.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
event_from_exception,
1414
current_stacktrace,
1515
capture_internal_exceptions,
16-
has_logs_enabled,
1716
)
1817
from sentry_sdk.integrations import Integration
1918

@@ -337,7 +336,7 @@ def emit(self, record: LogRecord) -> Any:
337336
if not client.is_active():
338337
return
339338

340-
if not has_logs_enabled(client.options):
339+
if client.options.get("enable_logs") is not True:
341340
return
342341

343342
self._capture_log_from_record(client, record)

0 commit comments

Comments
 (0)