Add workspace_id support for multi-workspace tracking#3
Open
Conversation
Add workspace_id field throughout the ingestion pipeline to enable per-website attribution within workspaces for multi-site analytics. Changes: - AuthResponse: Add workspace_id field from daemon auth validation - AuthContext: Extract and require workspace_id from auth response - ClickHouseEvent: Add workspace_id to event transformation pipeline - transform_batch: Pass workspace_id through event processing - ClickHouse row structs: Add workspace_id to all 12 specialized tables - ClickHouse schema: Update all table definitions with workspace_id column - Query functions: Include workspace_id in query results - Mock auth: Generate deterministic workspace_id for testing - Tests: Update all tests to include workspace_id assertions The workspace_id is required (not optional) and flows from: SDK request → Auth validation → Event transform → ClickHouse insert Breaking change: workspace_id is now required in auth responses.
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
This PR adds workspace ID support throughout the system to enable multi-workspace tracking and data isolation. The workspace ID is now extracted from the auth response, propagated through the event processing pipeline, and stored in all ClickHouse tables alongside the project ID.
Key Changes
workspace_idfield toAuthContextandAuthResponsestructs with extraction logic and mock generationClickHouseEvent::from_sdk()to accept and store workspace ID, modifiedtransform_batch()to pass workspace ID through the transformation pipelineworkspace_idcolumn to all event and metric tables (events, sessions, pageviews, clicks, scroll_events, mouse_moves, form_events, errors, performance_metrics, visibility_events, resource_loads, geographic, custom_events)workspace_idfield in result rowsImplementation Details