-
Notifications
You must be signed in to change notification settings - Fork 7k
feat(telemetry): add client_type field and remove desktop from payloads #8812
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
base: main
Are you sure you want to change the base?
Conversation
…yService to handle client type
WalkthroughThe changes introduce a new optional Changes
Sequence Diagram(s)sequenceDiagram
participant Env as Environment
participant Service as TelemetryService
participant Payload as TelemetryPayload
Env->>Service: Initialize TelemetryService
Service->>Service: _get_client_type() (checks LANGFLOW_DESKTOP)
Service->>Service: Stores client_type ("desktop" or "oss")
Service->>Payload: Create payload (e.g., RunPayload)
Service->>Service: send_telemetry_data(payload)
alt payload.client_type not set
Service->>Payload: Set payload.client_type = Service.client_type
end
Service->>...: Proceed with telemetry logic
sequenceDiagram
participant Test as Test Suite
participant Payload as TelemetryPayload
loop For each payload type
Test->>Payload: Instantiate with/without client_type
Test->>Payload: Serialize to dict (check alias)
Test->>Payload: Test edge cases (invalid/None/long/special)
Test->>Payload: Assert correct behavior
end
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (5)`src/backend/**/*.py`: Run make format_backend to format Python code early and often Run make lint to check for linting issues in backend Python code
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc) List of files the instruction was applied to:
`src/backend/tests/unit/**/*.py`: Use in-memory SQLite for database tests Test c...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc) List of files the instruction was applied to:
`src/backend/tests/**/*.py`: Unit tests for backend code should be located in 's...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc) List of files the instruction was applied to:
`{src/backend/tests/**/*.py,src/frontend/**/*.test.{ts,tsx,js,jsx},src/frontend/...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc) List of files the instruction was applied to:
`{src/backend/tests/**/*.py,tests/**/*.py}`: Use '@pytest.mark.asyncio' for asyn...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc) List of files the instruction was applied to:
🧠 Learnings (1)src/backend/tests/unit/services/telemetry/test_telemetry_schema.py (15)
🪛 Pylint (3.3.7)src/backend/base/langflow/services/telemetry/schema.py[refactor] 12-12: Too few public methods (0/2) (R0903) [refactor] 29-29: Too few public methods (0/2) (R0903) [refactor] 37-37: Too few public methods (0/2) (R0903) src/backend/tests/unit/services/telemetry/test_telemetry_schema.py[error] 7-13: No name 'services' in module 'langflow' (E0611) ⏰ Context from checks skipped due to timeout of 90000ms (11)
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Note Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
Here are the copyable unit test edits: Copyable Editssrc/backend/tests/unit/base/langflow/services/telemetry/test_schema.pyThis is a new file.
src/backend/tests/unit/base/langflow/services/telemetry/test_service.pyThis is a new file.
|
- Introduced unit tests for `RunPayload`, `ShutdownPayload`, `VersionPayload`, `PlaygroundPayload`, and `ComponentPayload` to ensure proper initialization, serialization, and edge case handling. - Implemented tests for various scenarios including default values, negative inputs, and serialization with special characters. - Added performance tests to evaluate payload creation and serialization efficiency. - Included fixtures for sample payloads to streamline testing processes.
Introduce a new
client_type
field in telemetry payloads and modify the TelemetryService to set and utilize this field appropriately.Summary by CodeRabbit
New Features
Bug Fixes
Tests