Commit 29b2d28
committed
feat(Mountain/RPC): Integrate OpenTelemetry and strict validation across Vine gRPC services
This commit enhances the robustness and observability of the `Mountain` backend's RPC layer, which implements the `Vine` protocol for communication with `Cocoon` and `Wind`. It introduces a standardized instrumentation and validation framework across `CommandService`, `SecretStorageService`, `WindowService`, and `WorkspaceService`.
**Key Changes:**
* **Observability (Telemetry):** Integrated OpenTelemetry spans and metrics (via `opentelemetry`) into all major RPC services. A new `Telemetry` module provides centralized `ServiceMetrics` and span creation utilities. This allows tracking of operation latency (e.g., `command_execution_latency_us`), error rates, and throughput (e.g., `secrets_stored`), gated by the `Telemetry` feature flag.
* **Input Validation:** Added a dedicated `Command/Validation` module and inline validation logic to services. This includes sanitization for command IDs (format checks), secret keys (alphanumeric checks), and file paths (injection prevention). It enforces strict length limits and character filtering to prevent malformed requests from the `Cocoon` extension host.
* **Refactoring & Modernization:** Unified service constructors to a `Create` pattern and refactored public methods to adhere to PascalCase naming (e.g., `register_command_impl` -> `RegisterCommand`). Enhanced error handling to convert internal errors into `tonic::Status` with context preservation.
* **Defensive Coding:** Implemented timeout handling for long-running commands (30s default), file size limits (50MB max), and atomic state updates using `parking_lot` locks to ensure thread safety within the `MountainEnvironment`.
These changes ensure that the `Mountain` backend is production-ready with deep insights into system performance and hardened against malformed data originating from extensions.1 parent cb490c0 commit 29b2d28
8 files changed
Lines changed: 1537 additions & 1265 deletions
File tree
- Source/RPC
- Command/Validation
- Telemetry
- Metrics
- Spans
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
0 commit comments