Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Pending
### Fixed
- Attach `transaction_id` to error context to support querying for matching logs in errors service.

## [3.5.0] 2025-10-31
### Added
Expand Down
1 change: 1 addition & 0 deletions src/scout_apm/core/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def send(

context = {}
context.update(tracked_request.tags)
context["transaction_id"] = tracked_request.request_id

if custom_params:
context["custom_params"] = custom_params
Expand Down
14 changes: 9 additions & 5 deletions tests/unit/core/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_monitor_ignore_exceptions(error_monitor_errors):
"request_session": None,
"environment": None,
"request_components": None,
"context": {"spam": "foo"},
"context": {"spam": "foo", "transaction_id": "sample_id"},
"host": None,
"revision_sha": "",
},
Expand All @@ -101,7 +101,7 @@ def test_monitor_ignore_exceptions(error_monitor_errors):
"controller": "test-controller",
"action": None,
},
"context": {"spam": "foo"},
"context": {"spam": "foo", "transaction_id": "sample_id"},
"host": None,
"revision_sha": "",
},
Expand All @@ -128,7 +128,7 @@ def test_monitor_ignore_exceptions(error_monitor_errors):
"controller": "DataView",
"action": "detail",
},
"context": {"spam": "foo"},
"context": {"spam": "foo", "transaction_id": "sample_id"},
"host": None,
"revision_sha": "",
},
Expand All @@ -155,7 +155,11 @@ def test_monitor_ignore_exceptions(error_monitor_errors):
"controller": "test-controller",
"action": "detail",
},
"context": {"spam": "foo", "custom_params": {"baz": 3}},
"context": {
"spam": "foo",
"transaction_id": "sample_id",
"custom_params": {"baz": 3},
},
"host": None,
"revision_sha": "",
},
Expand Down Expand Up @@ -247,7 +251,7 @@ def test_monitor_with_logged_payload(
assert "ZeroDivisionError" in actual_message
assert "division by zero" in actual_message
assert (
"tests/unit/core/test_error.py:227:in test_monitor_with_logged_payload"
"tests/unit/core/test_error.py:231:in test_monitor_with_logged_payload"
in actual_message
)
assert "sample.app" in actual_message
Expand Down
Loading