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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Python
__pycache__/
.venv/
.DS_Store

# generated log files
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Changelog

## Pending
### Changed
- Rename `scout_request_id` log attribute to `scout_transaction_id` for compatability (#28)

## [1.0.1] 2024-09-12
### Added
- Django configuration compatibility (#24)
- Update package name in documentation (#22)

## [1.0.0] 2024-09-10
### Added
- Rename handler class to `ScoutLogHandler` for clarity (#19)

## [0.1.2] 2024-09-05
### Added
- Update readme with installation instructions (#17)
- Setting controller endpoint on log records (#15)
- Release workflow for automated publishing (#13)
- Attach controller endpoint to log entries (#11)
- Tests and GitHub Actions CI (#7)
- Scout Request Context integration (#5)
- Initial logging handler implementation (#3)
- OpenTelemetry logger integration (#1)
- Initial commit
2 changes: 1 addition & 1 deletion scout_apm_logging/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def emit(self, record):
)

# Add Scout-specific attributes to the log record
record.scout_request_id = scout_request.request_id
record.scout_transaction_id = scout_request.request_id
record.scout_start_time = scout_request.start_time.isoformat()
# Add duration if the request is completed
if scout_request.end_time:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_emit_with_scout_request(mock_tracked_request, otel_scout_handler):
otel_scout_handler.emit(record)

mock_otel_handler.emit.assert_called_once()
assert record.scout_request_id == "test-id"
assert record.scout_transaction_id == "test-id"
assert record.scout_start_time == "2024-03-06T12:00:00"
assert record.scout_end_time == "2024-03-06T12:00:01"
assert record.scout_tag_key == "value"
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_emit_when_scout_request_contains_operation(
otel_scout_handler.emit(record)

mock_otel_handler.emit.assert_called_once()
assert record.scout_request_id == "test-id"
assert record.scout_transaction_id == "test-id"
assert record.scout_start_time == "2024-03-06T12:00:00"
assert record.scout_end_time == "2024-03-06T12:00:01"
assert record.scout_tag_key == "value"
Expand All @@ -117,7 +117,7 @@ def test_emit_without_scout_request(mock_tracked_request, otel_scout_handler):
otel_scout_handler.emit(record)

mock_otel_handler.emit.assert_called_once()
assert not hasattr(record, "scout_request_id")
assert not hasattr(record, "scout_transaction_id")


def test_emit_already_handling_log(otel_scout_handler):
Expand Down
Loading