feat: replace TCP sockets with WebSocket, MPLogger with OTel, StorageController as thread#1144
Draft
feat: replace TCP sockets with WebSocket, MPLogger with OTel, StorageController as thread#1144
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1144 +/- ##
==========================================
- Coverage 62.16% 57.64% -4.52%
==========================================
Files 40 42 +2
Lines 3898 3978 +80
==========================================
- Hits 2423 2293 -130
- Misses 1475 1685 +210 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…Controller process with thread Major architectural refactoring of OpenWPM's internal communication and infrastructure: - Replace raw TCP socket IPC between Extension and Python with a single bidirectional WebSocket connection per browser - Convert StorageController from a separate process (with TCP server) to a thread using multiprocess.Queue for data flow - Replace MPLogger with OpenTelemetry tracing + standard Python logging - Introduce ExtensionSocket Protocol type for backward-compatible command API - Fix Unicode double-encoding in escapeString (no longer needed with JSON/WebSocket) New files: - openwpm/telemetry.py: OTel TracerProvider + Python logging setup - openwpm/websocket_bridge.py: WebSocketBridge + ExtensionSocketAdapter - Extension/src/websocket-client.ts: Browser-side WebSocket client
c4b29e7 to
f3d75f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major architectural refactoring of OpenWPM's internal communication and infrastructure:
browser.socketsexperiment API)multiprocess.Queuefor data flowMPLoggerwith OpenTelemetry tracing + standard Python logging (structured traces, per-browser context, optional OTLP export)ExtensionSocketProtocol type for backward-compatibleBaseCommand.execute()signatureescapeString(was needed for old binary socket protocol, breaks JSON/WebSocket)New files
openwpm/telemetry.py— OTel TracerProvider + Python logging setupopenwpm/websocket_bridge.py— WebSocketBridge (asyncio WS server in thread) + ExtensionSocketAdapterExtension/src/websocket-client.ts— Browser-side WebSocket clientKey design decisions
BrowserParams,ManagerParams,CommandSequence,BaseCommand) unchangedTest plan