Skip to content
Merged
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
10 changes: 7 additions & 3 deletions drift/instrumentation/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ def process_view(
def _capture_replay_output(self, request: HttpRequest, response: HttpResponse, span_info: SpanInfo) -> None:
"""Capture response data on the span for REPLAY mode.

Sets OUTPUT_VALUE so the inbound replay span sent to the CLI includes
the actual response for UI comparison. Skips RECORD-mode concerns like
transforms, trace blocking, and schema merges.
Sets OUTPUT_VALUE and OUTPUT_SCHEMA_MERGES so the inbound replay span
sent to the CLI includes the actual response with correct schema hints
for UI display. Skips RECORD-mode concerns like transforms and trace
blocking.

Args:
request: Django HttpRequest object
Expand Down Expand Up @@ -313,6 +314,9 @@ def _capture_replay_output(self, request: HttpRequest, response: HttpResponse, s

span_info.span.set_attribute(TdSpanAttributes.OUTPUT_VALUE, json.dumps(output_value))

output_schema_merges = build_output_schema_merges(output_value)
span_info.span.set_attribute(TdSpanAttributes.OUTPUT_SCHEMA_MERGES, json.dumps(output_schema_merges))

def _normalize_html_response(self, response: HttpResponse) -> HttpResponse:
"""Normalize HTML response body for REPLAY mode comparison.

Expand Down
Loading