Skip to content

Commit 7857282

Browse files
merge master
2 parents 6a1d6b3 + 6c6705a commit 7857282

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2369
-388
lines changed

.github/release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,29 @@ changelog:
1111
- Feature
1212
- Improvement
1313
- New Integration
14+
commit_patterns:
15+
- "^feat(\([a-zA-Z0-9_-]+\))?:"
1416
- title: Bug Fixes 🐛
1517
labels:
1618
- "Changelog: Bugfix"
1719
- Bug
20+
commit_patterns:
21+
- "^(fix|bugfix)(\([a-zA-Z0-9_-]+\))?:"
22+
- title: Deprecations 🏗️
23+
labels:
24+
- "Changelog: Deprecation"
25+
commit_patterns:
26+
- "deprecat" # deprecation, deprecated
1827
- title: Documentation 📚
1928
labels:
2029
- "Changelog: Docs"
2130
- Docs
2231
- "Component: Docs"
32+
commit_patterns:
33+
- "^docs(\([a-zA-Z0-9_-]+\))?:"
2334
- title: Internal Changes 🔧
2435
labels:
2536
- "Changelog: Internal"
2637
- Quality Improvement
38+
commit_patterns:
39+
- "^(build|ref|chore|ci|tests|test)(\([a-zA-Z0-9_-]+\))?:"

.github/workflows/test-integrations-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
python-version: ${{ matrix.python-version }}
4646
allow-prereleases: true
4747
- name: Start Redis
48-
uses: supercharge/redis-github-action@1.8.1
48+
uses: supercharge/redis-github-action@v2
4949
- name: Install Java
5050
uses: actions/setup-java@v5
5151
with:

.github/workflows/update-tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
echo "date=$DATE" >> $GITHUB_OUTPUT
5555
5656
- name: Create pull request
57-
uses: actions/github-script@v8.0.0
57+
uses: actions/github-script@v8
5858
with:
5959
script: |
6060
const branchName = '${{ steps.create-branch.outputs.branch_name }}';

scripts/populate_tox/config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,13 @@
235235
"litestar": {
236236
"package": "litestar",
237237
"deps": {
238-
"*": ["pytest-asyncio", "python-multipart", "requests", "cryptography"],
238+
"*": [
239+
"pytest-asyncio",
240+
"python-multipart",
241+
"requests",
242+
"cryptography",
243+
"sniffio",
244+
],
239245
"<2.7": ["httpx<0.28"],
240246
},
241247
},

scripts/populate_tox/package_dependencies.jsonl

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

scripts/populate_tox/releases.jsonl

Lines changed: 21 additions & 22 deletions
Large diffs are not rendered by default.

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
{% if needs_redis %}
5858
- name: Start Redis
59-
uses: supercharge/redis-github-action@1.8.1
59+
uses: supercharge/redis-github-action@2
6060
{% endif %}
6161

6262
{% if needs_java %}

sentry_sdk/_log_batcher.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,21 @@ def add(
8383

8484
with self._lock:
8585
if len(self._log_buffer) >= self.MAX_LOGS_BEFORE_DROP:
86+
# Construct log envelope item without sending it to report lost bytes
87+
log_item = Item(
88+
type="log",
89+
content_type="application/vnd.sentry.items.log+json",
90+
headers={
91+
"item_count": 1,
92+
},
93+
payload=PayloadRef(
94+
json={"items": [LogBatcher._log_to_transport_format(log)]}
95+
),
96+
)
8697
self._record_lost_func(
8798
reason="queue_overflow",
8899
data_category="log_item",
100+
item=log_item,
89101
quantity=1,
90102
)
91103
return None

sentry_sdk/_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ class SDKInfo(TypedDict):
294294
"monitor",
295295
"span",
296296
"log_item",
297+
"log_byte",
297298
"trace_metric",
298299
]
299300
SessionStatus = Literal["ok", "exited", "crashed", "abnormal"]

sentry_sdk/client.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@
6767
from sentry_sdk.scope import Scope
6868
from sentry_sdk.session import Session
6969
from sentry_sdk.spotlight import SpotlightClient
70-
from sentry_sdk.transport import Transport
70+
from sentry_sdk.transport import Transport, Item
7171
from sentry_sdk._log_batcher import LogBatcher
7272
from sentry_sdk._metrics_batcher import MetricsBatcher
73+
from sentry_sdk.utils import Dsn
7374

7475
I = TypeVar("I", bound=Integration) # noqa: E741
7576

@@ -201,6 +202,11 @@ def dsn(self):
201202
# type: () -> Optional[str]
202203
return None
203204

205+
@property
206+
def parsed_dsn(self):
207+
# type: () -> Optional[Dsn]
208+
return None
209+
204210
def should_send_default_pii(self):
205211
# type: () -> bool
206212
return False
@@ -354,19 +360,23 @@ def _init_impl(self):
354360

355361
def _capture_envelope(envelope):
356362
# type: (Envelope) -> None
363+
if self.spotlight is not None:
364+
self.spotlight.capture_envelope(envelope)
357365
if self.transport is not None:
358366
self.transport.capture_envelope(envelope)
359367

360368
def _record_lost_event(
361369
reason, # type: str
362370
data_category, # type: EventDataCategory
371+
item=None, # type: Optional[Item]
363372
quantity=1, # type: int
364373
):
365374
# type: (...) -> None
366375
if self.transport is not None:
367376
self.transport.record_lost_event(
368377
reason=reason,
369378
data_category=data_category,
379+
item=item,
370380
quantity=quantity,
371381
)
372382

@@ -379,6 +389,18 @@ def _record_lost_event(
379389
if self.options["enable_backpressure_handling"]:
380390
self.monitor = Monitor(self.transport)
381391

392+
# Setup Spotlight before creating batchers so _capture_envelope can use it.
393+
# setup_spotlight handles all config/env var resolution per the SDK spec.
394+
from sentry_sdk.spotlight import setup_spotlight
395+
396+
self.spotlight = setup_spotlight(self.options)
397+
if self.spotlight is not None and not self.options["dsn"]:
398+
sample_all = lambda *_args, **_kwargs: 1.0
399+
self.options["send_default_pii"] = True
400+
self.options["error_sampler"] = sample_all
401+
self.options["traces_sampler"] = sample_all
402+
self.options["profiles_sampler"] = sample_all
403+
382404
self.session_flusher = SessionFlusher(capture_func=_capture_envelope)
383405

384406
self.log_batcher = None
@@ -429,29 +451,6 @@ def _record_lost_event(
429451
options=self.options,
430452
)
431453

432-
spotlight_config = self.options.get("spotlight")
433-
if spotlight_config is None and "SENTRY_SPOTLIGHT" in os.environ:
434-
spotlight_env_value = os.environ["SENTRY_SPOTLIGHT"]
435-
spotlight_config = env_to_bool(spotlight_env_value, strict=True)
436-
self.options["spotlight"] = (
437-
spotlight_config
438-
if spotlight_config is not None
439-
else spotlight_env_value
440-
)
441-
442-
if self.options.get("spotlight"):
443-
# This is intentionally here to prevent setting up spotlight
444-
# stuff we don't need unless spotlight is explicitly enabled
445-
from sentry_sdk.spotlight import setup_spotlight
446-
447-
self.spotlight = setup_spotlight(self.options)
448-
if not self.options["dsn"]:
449-
sample_all = lambda *_args, **_kwargs: 1.0
450-
self.options["send_default_pii"] = True
451-
self.options["error_sampler"] = sample_all
452-
self.options["traces_sampler"] = sample_all
453-
self.options["profiles_sampler"] = sample_all
454-
455454
sdk_name = get_sdk_name(list(self.integrations.keys()))
456455
SDK_INFO["name"] = sdk_name
457456
logger.debug("Setting SDK name to '%s'", sdk_name)
@@ -510,6 +509,12 @@ def dsn(self):
510509
"""Returns the configured DSN as string."""
511510
return self.options["dsn"]
512511

512+
@property
513+
def parsed_dsn(self):
514+
# type: () -> Optional[Dsn]
515+
"""Returns the configured parsed DSN object."""
516+
return self.transport.parsed_dsn if self.transport else None
517+
513518
def _prepare_event(
514519
self,
515520
event, # type: Event

0 commit comments

Comments
 (0)