Skip to content

Sync #4407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 20, 2025
Merged

Sync #4407

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
de6856f
feat(logs): Forward extra from logger as attributes (#4374)
AbhiPrasad May 9, 2025
53f413e
release: 2.28.0
getsentry-bot May 12, 2025
c7a17a0
Update changelog.md
antonpirker May 12, 2025
0c95a73
Merge branch 'release/2.28.0'
May 12, 2025
1090eee
apidocs: Remove snowballstemmer pin (#4379)
sentrivana May 12, 2025
eee4cac
fix(logs): Make `sentry.message.parameters` singular as per spec (#4387)
AbhiPrasad May 13, 2025
c639f1c
ci: Fix pyspark test suite (#4382)
sentrivana May 15, 2025
aa0eaab
fix(typing): Add before_send_log to Experiments (#4383)
sentrivana May 15, 2025
2f97cda
fix(celery): Do not send extra check-in (#4395)
sentrivana May 19, 2025
f572757
feat: Allow configuring `keep_alive` via environment variable (#4366)
szokeasaurusrex May 19, 2025
830f270
fix(loguru): Move integration setup from `__init__` to `setup_once` (…
sentrivana May 19, 2025
0c9333e
release: 2.29.0
getsentry-bot May 19, 2025
8be519f
Merge branch 'release/2.29.0'
May 19, 2025
3ebd122
fix(logs): send `severity_text`: `warn` instead of `warning` (#4396)
lcian May 19, 2025
7973ac0
release: 2.29.1
getsentry-bot May 19, 2025
e2e8f92
Merge branch 'release/2.29.1'
May 19, 2025
83e0386
tests(logs): avoid failures when running with integrations enabled (#…
rominf May 20, 2025
94414cd
Increase test coverage (#4393)
mgaligniana May 20, 2025
9261b2c
build(deps): bump codecov/codecov-action from 5.4.2 to 5.4.3 (#4397)
dependabot[bot] May 20, 2025
04add55
Merge branch 'master' into potel-base
sentrivana May 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-dbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-gevent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-web-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-web-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,43 @@ for your feedback. How was the migration? Is everything working as expected? Is
[on GitHub](https://github.com/getsentry/sentry-python/discussions/3936) or
[on Discord](https://discord.gg/wdNEHETs87).

## 2.29.1

### Various fixes & improvements

- fix(logs): send `severity_text`: `warn` instead of `warning` (#4396) by @lcian

## 2.29.0

### Various fixes & improvements

- fix(loguru): Move integration setup from `__init__` to `setup_once` (#4399) by @sentrivana
- feat: Allow configuring `keep_alive` via environment variable (#4366) by @szokeasaurusrex
- fix(celery): Do not send extra check-in (#4395) by @sentrivana
- fix(typing): Add before_send_log to Experiments (#4383) by @sentrivana
- ci: Fix pyspark test suite (#4382) by @sentrivana
- fix(logs): Make `sentry.message.parameters` singular as per spec (#4387) by @AbhiPrasad
- apidocs: Remove snowballstemmer pin (#4379) by @sentrivana

## 2.28.0

### Various fixes & improvements

- fix(logs): Forward `extra` from logger as attributes (#4374) by @AbhiPrasad
- fix(logs): Canonicalize paths from the logger integration (#4336) by @colin-sentry
- fix(logs): Use new transport (#4317) by @colin-sentry
- fix: Deprecate `set_measurement()` API. (#3934) by @antonpirker
- fix: Put feature flags on isolation scope (#4363) by @antonpirker
- fix: Make use of `SPANDATA` consistent (#4373) by @antonpirker
- fix: Discord link (#4371) by @sentrivana
- tests: Pin snowballstemmer for now (#4372) by @sentrivana
- tests: Regular tox update (#4367) by @sentrivana
- tests: Bump test timeout for recursion stacktrace extract to 2s (#4351) by @booxter
- tests: Fix test_stacktrace_big_recursion failure due to argv (#4346) by @booxter
- tests: Move anthropic under toxgen (#4348) by @sentrivana
- tests: Update tox.ini (#4347) by @sentrivana
- chore: Update GH issue templates for Linear compatibility (#4328) by @stephanie-anderson
- chore: Bump actions/create-github-app-token from 2.0.2 to 2.0.6 (#4358) by @dependabot

## 2.27.0

Expand Down
1 change: 0 additions & 1 deletion requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ shibuya
sphinx<8.2
sphinx-autodoc-typehints[type_comments]>=1.8.0
typing-extensions
snowballstemmer<3.0
2 changes: 1 addition & 1 deletion scripts/split_tox_gh_actions/templates/test_group.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

- name: Upload coverage to Codecov
if: {% raw %}${{ !cancelled() }}{% endraw %}
uses: codecov/[email protected].2
uses: codecov/[email protected].3
with:
token: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %}
files: coverage.xml
Expand Down
5 changes: 5 additions & 0 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def _get_options(*args, **kwargs):
)
rv["socket_options"] = None

if rv["keep_alive"] is None:
rv["keep_alive"] = (
env_to_bool(os.environ.get("SENTRY_KEEP_ALIVE"), strict=True) or False
)

return rv


Expand Down
5 changes: 3 additions & 2 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import itertools

from enum import Enum
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -47,6 +46,7 @@ class CompressionAlgo(Enum):
Event,
EventProcessor,
Hint,
Log,
ProfilerMode,
TracesSampler,
TransactionProcessor,
Expand All @@ -71,6 +71,7 @@ class CompressionAlgo(Enum):
"transport_num_pools": Optional[int],
"transport_http2": Optional[bool],
"enable_logs": Optional[bool],
"before_send_log": Optional[Callable[[Log, Hint], Optional[Log]]],
},
total=False,
)
Expand Down Expand Up @@ -622,7 +623,7 @@ def __init__(
ignore_errors=[], # type: Sequence[Union[type, str]] # noqa: B006
max_request_body_size="medium", # type: str
socket_options=None, # type: Optional[List[Tuple[int, int, int | bytes]]]
keep_alive=False, # type: bool
keep_alive=None, # type: Optional[bool]
before_send=None, # type: Optional[EventProcessor]
before_breadcrumb=None, # type: Optional[BreadcrumbProcessor]
debug=None, # type: Optional[bool]
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sentry_sdk.integrations import _check_minimum_version, Integration, DidNotEnable
from sentry_sdk.integrations.celery.beat import (
_patch_beat_apply_entry,
_patch_redbeat_maybe_due,
_patch_redbeat_apply_async,
_setup_celery_beat_signals,
)
from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch
Expand Down Expand Up @@ -72,7 +72,7 @@ def __init__(
self.exclude_beat_tasks = exclude_beat_tasks

_patch_beat_apply_entry()
_patch_redbeat_maybe_due()
_patch_redbeat_apply_async()
_setup_celery_beat_signals(monitor_beat_tasks)

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/celery/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ def _patch_beat_apply_entry():
Scheduler.apply_entry = _wrap_beat_scheduler(Scheduler.apply_entry)


def _patch_redbeat_maybe_due():
def _patch_redbeat_apply_async():
# type: () -> None
if RedBeatScheduler is None:
return

RedBeatScheduler.maybe_due = _wrap_beat_scheduler(RedBeatScheduler.maybe_due)
RedBeatScheduler.apply_async = _wrap_beat_scheduler(RedBeatScheduler.apply_async)


def _setup_celery_beat_signals(monitor_beat_tasks):
Expand Down
12 changes: 5 additions & 7 deletions sentry_sdk/integrations/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,23 +353,21 @@ def emit(self, record):
if not client.options["_experiments"].get("enable_logs", False):
return

SentryLogsHandler._capture_log_from_record(client, record)
self._capture_log_from_record(client, record)

@staticmethod
def _capture_log_from_record(client, record):
def _capture_log_from_record(self, client, record):
# type: (BaseClient, LogRecord) -> None
scope = sentry_sdk.get_current_scope()
otel_severity_number, otel_severity_text = _python_level_to_otel(record.levelno)
project_root = client.options["project_root"]
attrs = {
"sentry.origin": "auto.logger.log",
} # type: dict[str, str | bool | float | int]
attrs = self._extra_from_record(record) # type: Any
attrs["sentry.origin"] = "auto.logger.log"
if isinstance(record.msg, str):
attrs["sentry.message.template"] = record.msg
if record.args is not None:
if isinstance(record.args, tuple):
for i, arg in enumerate(record.args):
attrs[f"sentry.message.parameters.{i}"] = (
attrs[f"sentry.message.parameter.{i}"] = (
arg
if isinstance(arg, str)
or isinstance(arg, float)
Expand Down
Loading
Loading