-
Notifications
You must be signed in to change notification settings - Fork 469
feat: add span pointer attributes for websocket context propagation #15153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
Bootstrap import analysisComparison of import times between this PR and base. SummaryThe average import time from this PR is: 259 ± 5 ms. The average import time from base is: 264 ± 5 ms. The import time difference between this PR and base is: -4.9 ± 0.2 ms. Import time breakdownThe following import paths have grown:
|
Performance SLOsComparing candidate quinna.halim/websocket-context-propagation (32cc0b1) with baseline main (73f2611) 🟡 Near SLO Breach (3 suites)🟡 flasksimple - 18/18✅ appsec-getTime: ✅ 4.595ms (SLO: <4.750ms -3.3%) vs baseline: +0.2% Memory: ✅ 64.000MB (SLO: <66.500MB -3.8%) vs baseline: +4.7% ✅ appsec-postTime: ✅ 6.619ms (SLO: <6.750ms 🟡 -1.9%) vs baseline: ~same Memory: ✅ 64.101MB (SLO: <66.500MB -3.6%) vs baseline: +4.9% ✅ appsec-telemetryTime: ✅ 4.600ms (SLO: <4.750ms -3.2%) vs baseline: +0.2% Memory: ✅ 63.995MB (SLO: <66.500MB -3.8%) vs baseline: +4.9% ✅ debuggerTime: ✅ 1.856ms (SLO: <2.000ms -7.2%) vs baseline: +0.2% Memory: ✅ 47.901MB (SLO: <49.500MB -3.2%) vs baseline: +4.9% ✅ iast-getTime: ✅ 1.859ms (SLO: <2.000ms -7.0%) vs baseline: +0.2% Memory: ✅ 44.368MB (SLO: <49.000MB -9.5%) vs baseline: +4.8% ✅ profilerTime: ✅ 1.929ms (SLO: <2.100ms -8.1%) vs baseline: +0.2% Memory: ✅ 48.599MB (SLO: <50.000MB -2.8%) vs baseline: +4.5% ✅ resource-renamingTime: ✅ 3.366ms (SLO: <3.650ms -7.8%) vs baseline: -0.3% Memory: ✅ 54.414MB (SLO: <56.000MB -2.8%) vs baseline: +4.9% ✅ tracerTime: ✅ 3.355ms (SLO: <3.650ms -8.1%) vs baseline: -0.2% Memory: ✅ 54.291MB (SLO: <56.500MB -3.9%) vs baseline: +4.7% ✅ tracer-nativeTime: ✅ 3.360ms (SLO: <3.650ms -7.9%) vs baseline: +0.2% Memory: ✅ 54.294MB (SLO: <60.000MB -9.5%) vs baseline: +4.9% 🟡 otelspan - 22/22✅ add-eventTime: ✅ 38.526ms (SLO: <47.150ms 📉 -18.3%) vs baseline: -0.4% Memory: ✅ 39.019MB (SLO: <47.000MB 📉 -17.0%) vs baseline: +4.7% ✅ add-metricsTime: ✅ 259.243ms (SLO: <344.800ms 📉 -24.8%) vs baseline: +1.3% Memory: ✅ 43.332MB (SLO: <47.500MB -8.8%) vs baseline: +4.7% ✅ add-tagsTime: ✅ 316.885ms (SLO: <321.000ms 🟡 -1.3%) vs baseline: +0.8% Memory: ✅ 43.274MB (SLO: <47.500MB -8.9%) vs baseline: +4.8% ✅ get-contextTime: ✅ 78.750ms (SLO: <92.350ms 📉 -14.7%) vs baseline: ~same Memory: ✅ 39.273MB (SLO: <46.500MB 📉 -15.5%) vs baseline: +5.1% ✅ is-recordingTime: ✅ 36.224ms (SLO: <44.500ms 📉 -18.6%) vs baseline: +0.1% Memory: ✅ 38.805MB (SLO: <47.500MB 📉 -18.3%) vs baseline: +5.4% ✅ record-exceptionTime: ✅ 57.060ms (SLO: <67.650ms 📉 -15.7%) vs baseline: -0.2% Memory: ✅ 39.530MB (SLO: <47.000MB 📉 -15.9%) vs baseline: +5.3% ✅ set-statusTime: ✅ 42.289ms (SLO: <50.400ms 📉 -16.1%) vs baseline: -0.7% Memory: ✅ 38.761MB (SLO: <47.000MB 📉 -17.5%) vs baseline: +4.9% ✅ startTime: ✅ 36.258ms (SLO: <43.450ms 📉 -16.6%) vs baseline: +2.4% Memory: ✅ 38.744MB (SLO: <47.000MB 📉 -17.6%) vs baseline: +5.3% ✅ start-finishTime: ✅ 81.883ms (SLO: <88.000ms -7.0%) vs baseline: +0.3% Memory: ✅ 36.648MB (SLO: <46.500MB 📉 -21.2%) vs baseline: +4.7% ✅ start-finish-telemetryTime: ✅ 83.532ms (SLO: <89.000ms -6.1%) vs baseline: +0.1% Memory: ✅ 36.608MB (SLO: <46.500MB 📉 -21.3%) vs baseline: +5.1% ✅ update-nameTime: ✅ 36.907ms (SLO: <45.150ms 📉 -18.3%) vs baseline: -0.1% Memory: ✅ 38.897MB (SLO: <47.000MB 📉 -17.2%) vs baseline: +4.8% 🟡 telemetryaddmetric - 30/30✅ 1-count-metric-1-timesTime: ✅ 2.920µs (SLO: <20.000µs 📉 -85.4%) vs baseline: +0.4% Memory: ✅ 34.544MB (SLO: <35.500MB -2.7%) vs baseline: +4.7% ✅ 1-count-metrics-100-timesTime: ✅ 198.188µs (SLO: <220.000µs -9.9%) vs baseline: -1.1% Memory: ✅ 34.505MB (SLO: <35.500MB -2.8%) vs baseline: +4.7% ✅ 1-distribution-metric-1-timesTime: ✅ 3.297µs (SLO: <20.000µs 📉 -83.5%) vs baseline: -0.3% Memory: ✅ 34.544MB (SLO: <35.500MB -2.7%) vs baseline: +4.8% ✅ 1-distribution-metrics-100-timesTime: ✅ 214.228µs (SLO: <220.000µs -2.6%) vs baseline: -0.3% Memory: ✅ 34.544MB (SLO: <35.500MB -2.7%) vs baseline: +5.0% ✅ 1-gauge-metric-1-timesTime: ✅ 2.171µs (SLO: <20.000µs 📉 -89.1%) vs baseline: +1.2% Memory: ✅ 34.564MB (SLO: <35.500MB -2.6%) vs baseline: +4.7% ✅ 1-gauge-metrics-100-timesTime: ✅ 135.853µs (SLO: <150.000µs -9.4%) vs baseline: -0.8% Memory: ✅ 34.524MB (SLO: <35.500MB -2.7%) vs baseline: +4.6% ✅ 1-rate-metric-1-timesTime: ✅ 3.073µs (SLO: <20.000µs 📉 -84.6%) vs baseline: +1.3% Memory: ✅ 34.446MB (SLO: <35.500MB -3.0%) vs baseline: +4.6% ✅ 1-rate-metrics-100-timesTime: ✅ 210.028µs (SLO: <250.000µs 📉 -16.0%) vs baseline: -0.3% Memory: ✅ 34.544MB (SLO: <35.500MB -2.7%) vs baseline: +5.1% ✅ 100-count-metrics-100-timesTime: ✅ 20.018ms (SLO: <22.000ms -9.0%) vs baseline: +0.5% Memory: ✅ 34.465MB (SLO: <35.500MB -2.9%) vs baseline: +4.9% ✅ 100-distribution-metrics-100-timesTime: ✅ 2.267ms (SLO: <2.300ms 🟡 -1.4%) vs baseline: -0.5% Memory: ✅ 34.505MB (SLO: <35.500MB -2.8%) vs baseline: +4.9% ✅ 100-gauge-metrics-100-timesTime: ✅ 1.399ms (SLO: <1.550ms -9.8%) vs baseline: -0.2% Memory: ✅ 34.564MB (SLO: <35.500MB -2.6%) vs baseline: +5.0% ✅ 100-rate-metrics-100-timesTime: ✅ 2.200ms (SLO: <2.550ms 📉 -13.7%) vs baseline: +1.4% Memory: ✅ 34.524MB (SLO: <35.500MB -2.7%) vs baseline: +4.7% ✅ flush-1-metricTime: ✅ 4.579µs (SLO: <20.000µs 📉 -77.1%) vs baseline: -0.5% Memory: ✅ 34.485MB (SLO: <35.500MB -2.9%) vs baseline: +4.7% ✅ flush-100-metricsTime: ✅ 172.765µs (SLO: <250.000µs 📉 -30.9%) vs baseline: -0.3% Memory: ✅ 34.564MB (SLO: <35.500MB -2.6%) vs baseline: +4.7% ✅ flush-1000-metricsTime: ✅ 2.110ms (SLO: <2.500ms 📉 -15.6%) vs baseline: +0.3% Memory: ✅ 35.330MB (SLO: <36.500MB -3.2%) vs baseline: +4.8%
|
mabdinur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some nits. Overall LGTM
releasenotes/notes/websocket-span-pointers-25e07939aa75527a.yaml
Outdated
Show resolved
Hide resolved
tests/snapshots/tests.contrib.fastapi.test_fastapi.test_websocket_context_propagation.json
Show resolved
Hide resolved
tlhunter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation seems to follow the spec correctly. However I'm unable to review the Python-isms.
brettlangdon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release note nit, otherwise lgtm
releasenotes/notes/websocket-span-pointers-25e07939aa75527a.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
…15153) ## Description <!-- Provide an overview of the change and motivation for the change --> From [RFC](https://docs.google.com/document/d/1RhIoUJhY7nawH9pkdbtbNy_G-7P02IR76Ka-SyJQ4f8/edit?tab=t.0): > There is no direct context extraction on the incoming messages traced since they already hold a relationship (a link) to the trace where the context propagation happens (the handshake). The same applies to the send message spans (for context injection). This PR implements span pointers to connect outgoing and incoming messages over websocket. Span pointer attributes: - link.name: span-pointer-down (if outgoing) / span-pointer-up (if incoming) - dd.kind: span-pointer - ptr.kind: websocket - ptr.dir: d (if outgoing) / u (if incoming) - ptr.hash: S<128 bit hex handshake trace id><64 bit hex handshake parent id><32 bit hex counter> (if outgoing on server or incoming on client) / C<128 bit hex handshake trace id><64 bit hex handshake parent id><32 bit hex counter> (if outgoing on client or incoming on server) ## Testing <!-- Describe your testing strategy or note what tests are included --> See `test_websocket_context_propagation` generated snapshot file `test_websocket_context_propagation` flame graph: `websocket.receive` parent and `websocket.send` / `websocket.close` <img width="929" height="204" alt="Screenshot 2025-11-10 at 3 28 26 PM" src="https://github.com/user-attachments/assets/4c2b6656-c38c-4953-b569-ece83ed1db72" /> <img width="929" height="247" alt="Screenshot 2025-11-10 at 3 28 58 PM" src="https://github.com/user-attachments/assets/f4cada27-e508-4444-9341-267a37ecac5a" /> ## Risks <!-- Note any risks associated with this change, or "None" if no risks --> ## Additional Notes <!-- Any other information that would be helpful for reviewers --> --------- Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
Description
From RFC:
This PR implements span pointers to connect outgoing and incoming messages over websocket.
Span pointer attributes:
Testing
See
test_websocket_context_propagationgenerated snapshot filetest_websocket_context_propagationflame graph:websocket.receiveparent andwebsocket.send/websocket.closeRisks
Additional Notes