forked from pool/python-sentry-sdk
* Fix incompatibility with new Strawberry version * Add failed_request_status_codes to Litestar * The enable_tracing option is now deprecated. Please use traces_sample_rate instead * Add Statsig integration * Fix(asyncio): Improve asyncio integration error handling * Fix memory leak by not piling up breadcrumbs forever in Spark workers * New Beta Feature Enable Sentry logs in logging Integration * Change CODEOWNERS back to Python SDK owners * Deprecate set_measurement() API * Allow configuring keep_alive via environment variable * Sentry logs for Loguru * Fix CI, adapt to new redis-py release * Add support for openai-agents * Add top-level start- and end session methods * Use span.data instead of measurements for token usage * Considerably raise DEFAULT_MAX_VALUE_LENGTH * The OpenAIIntegration now supports OpenAI Responses API * The data captured will also show up in the new AI Agents Dashboard * Langchain and Anthropic Integration now support the Sentry AI dashboard * Add the unraisable exception integration * Add support for langgraph * Many more fixes and improvements, see upstream changelog * Note: This is my last release. So long, and thanks for all the fish! by @antonpirker - Add upstream release.patch to fix failing test OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sentry-sdk?expand=0&rev=91
49 lines
2.2 KiB
Diff
49 lines
2.2 KiB
Diff
From f3e8a5ccd0a341cf139f474856163f0e5335741c Mon Sep 17 00:00:00 2001
|
|
From: Ivana Kellyer <ivana.kellyer@sentry.io>
|
|
Date: Fri, 3 Oct 2025 08:40:35 +0200
|
|
Subject: [PATCH] fix(tests): Don't assume release is set (#4879)
|
|
|
|
### Description
|
|
Even though we try to figure out the current release automatically if
|
|
it's not provided, it can still end up being `None`. If that's the case,
|
|
it won't be attached to logs. The `test_logs_attributes` test assumes
|
|
there always is a release, which is incorrect.
|
|
|
|
I opted for conditionally checking for `sentry.release` in the test
|
|
instead of removing the check altogether, even though the test itself is
|
|
supposed to test custom user provided attributes. The reason is that
|
|
there is no other generic logs test testing `sentry.release`.
|
|
|
|
#### Issues
|
|
Closes https://github.com/getsentry/sentry-python/issues/4878
|
|
|
|
#### Reminders
|
|
- Please add tests to validate your changes, and lint your code using
|
|
`tox -e linters`.
|
|
- Add GH Issue ID _&_ Linear ID (if applicable)
|
|
- PR title should use [conventional
|
|
commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type)
|
|
style (`feat:`, `fix:`, `ref:`, `meta:`)
|
|
- For external contributors:
|
|
[CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md),
|
|
[Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord
|
|
community](https://discord.gg/Ww9hbqr)
|
|
---
|
|
tests/test_logs.py | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/tests/test_logs.py b/tests/test_logs.py
|
|
index 596a31922e..1e252c5bfb 100644
|
|
--- a/tests/test_logs.py
|
|
+++ b/tests/test_logs.py
|
|
@@ -230,7 +230,8 @@ def test_logs_attributes(sentry_init, capture_envelopes):
|
|
for k, v in attrs.items():
|
|
assert logs[0]["attributes"][k] == v
|
|
assert logs[0]["attributes"]["sentry.environment"] == "production"
|
|
- assert "sentry.release" in logs[0]["attributes"]
|
|
+ if sentry_sdk.get_client().options.get("release") is not None:
|
|
+ assert "sentry.release" in logs[0]["attributes"]
|
|
assert logs[0]["attributes"]["sentry.message.parameter.my_var"] == "some value"
|
|
assert logs[0]["attributes"][SPANDATA.SERVER_ADDRESS] == "test-server"
|
|
assert logs[0]["attributes"]["sentry.sdk.name"].startswith("sentry.python")
|