Propagate AIQ request tags to NAT spans - #206
AjayThorve merged 4 commits into
Conversation
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Greptile SummaryThis PR wires resolved AIQ request tags (caller type, auth transport, verified status, access channel, and optional pseudonymous identifiers) into NAT-exported workflow spans for HTTP, WebSocket, and async Dask job paths. It does so by introducing a new Confidence Score: 5/5PR is safe to merge; no P0/P1 issues found in the changed paths. All three propagation paths (HTTP, WebSocket, Dask async) are correctly wired with appropriate context scoping. The monkey-patch is idempotent, the 7-tuple expansion in submit.py lines up with the run_agent_job signature, and the previously-flagged missing build_request_trace_tags symbol is now present. No security regressions or data-correctness bugs identified. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant AuthMiddleware
participant RequestTraceCtx as request_trace ContextVar
participant SpanExporter as NAT SpanExporter (patched)
participant DaskWorker as Dask Worker (run_agent_job)
Note over AuthMiddleware: install_request_trace_span_injection() on init
Client->>AuthMiddleware: HTTP / WebSocket request
AuthMiddleware->>AuthMiddleware: build_request_trace_tags(headers, scope, user)
AuthMiddleware->>RequestTraceCtx: request_trace_tag_context(tags).__enter__
AuthMiddleware->>SpanExporter: workflow emits spans via _process_start_event
SpanExporter->>RequestTraceCtx: get_request_trace_tags()
SpanExporter->>SpanExporter: set_attribute(nat.aiq.*, value) on span
Note over DaskWorker: Async job path
AuthMiddleware->>DaskWorker: submit job_args with *_get_parent_trace_context() (includes tags)
DaskWorker->>DaskWorker: install_request_trace_span_injection()
DaskWorker->>RequestTraceCtx: request_trace_tag_context(request_trace_tags).__enter__
DaskWorker->>SpanExporter: workflow spans tagged with caller context
Reviews (2): Last reviewed commit: "generalize request trace access channels" | Re-trigger Greptile |
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
|
Addressed the review blockers in the latest branch update:
Validation: |
* fix aiq request tags on nat spans Signed-off-by: Ajay Thorve <athorve@nvidia.com> * docs: clarify nat span request tagging Signed-off-by: Ajay Thorve <athorve@nvidia.com> * fix websocket request trace tags Signed-off-by: Ajay Thorve <athorve@nvidia.com> * generalize request trace access channels Signed-off-by: Ajay Thorve <athorve@nvidia.com> --------- Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Summary
Validation
Local E2E