-
Notifications
You must be signed in to change notification settings - Fork 92
feat(docs): add telemetry backend streaming architecture design #1092
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
Open
yakshithkd23
wants to merge
1
commit into
mosip:develop
Choose a base branch
from
yakshithkd23:backend_Server_1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Telemetry Backend Service | ||
|
|
||
| This directory contains the architectural design, data pipeline specifications, and documentation for the real-time telemetry processing backend. The system is engineered to ingest, process, and visualize application performance metrics, user interactions, and crash logs transmitted from the Android Registration Client. | ||
|
|
||
| ## System Overview | ||
|
|
||
| To safeguard client application performance and ensure reliable offline operations, the telemetry pipeline decouples high-throughput data ingestion from downstream analytical processing: | ||
|
|
||
| * **Client Buffering & Upload:** Telemetry events are queued locally on the Android device. Once network connectivity is established, logs are transmitted via the **TUS protocol** to handle large or interrupted file transfers safely. | ||
| * **High-Throughput Ingestion:** The `tusd-server` receives chunked file uploads and saves completed telemetry files to a shared local storage volume. | ||
| * **Zero-Overhead Log Shipping:** A lightweight **Vector** sidecar container monitors the shared volume, parses completed JSON files, and instantly streams them to a distributed message queue. | ||
| * **Stream Processing & Validation:** **Apache Spark Streaming** consumes the raw telemetry stream, executing real-time data cleansing, schema validation, and PII filtering. | ||
| * **Time-Series Storage:** Cleaned telemetry datasets are persisted in an analytical, time-series data warehouse optimized for rapid aggregations. | ||
| * **Real-Time Visualization:** An operational dashboard engine queries the datastore to provide administrators with live monitoring, system health metrics, and crash reporting. | ||
|
|
||
| --- | ||
|
|
||
| ## Technical Stack | ||
|
|
||
| * **Ingestion Protocol:** [TUS Resumable Upload Protocol](https://tus.io/) for resilient file transfers over HTTPS. | ||
| * **File Receiver:** `mosip/tusd-server` (the official TUS protocol implementation). | ||
| * **Data Pipeline & Shipper:** `timberio/vector` – a high-performance telemetry agent configured to watch, parse, and route JSON logs. | ||
| * **Message Broker:** Apache Kafka (managed via ZooKeeper) for high-throughput, fault-tolerant streaming queues. | ||
| * **Stream Processing Engine:** Apache Spark Streaming (for micro-batch processing, validation, and PII masking). | ||
| * **Data Warehouse:** Analytical, time-series optimized datastore (e.g., ClickHouse or PostgreSQL). | ||
| * **Visualization:** Dashboard engine (e.g., Grafana or Apache Superset) for live operator monitoring. | ||
|
|
||
| --- | ||
|
|
||
| ## Architectural Data Flow | ||
|
|
||
| The complete end-to-end data pipeline follows a strict reactive and decoupled flow: | ||
|
|
||
| ``` | ||
| [ Android Client ] | ||
| │ (TUS Protocol / HTTPS) | ||
| ▼ | ||
| [ TUSD Server ] ──────> [ Shared Volume ] ──────> [ Vector Sidecar ] | ||
| │ (TCP / JSON) | ||
| ▼ | ||
| [ Apache Kafka ] | ||
| │ | ||
| ▼ | ||
| [ Apache Spark Streaming ] | ||
| (Validation & PII Filtering) | ||
| │ | ||
| ▼ | ||
| [ Time-Series Database ] | ||
| (ClickHouse / PostgreSQL) | ||
| │ | ||
| ▼ | ||
| [ Operational Dashboard ] | ||
| (Grafana / Apache Superset) | ||
|
|
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Pipeline Stage Specifications | ||
|
|
||
| ### 1. Ingestion & Edge Shipping (`tusd` ➔ `Vector` ➔ `Kafka`) | ||
|
|
||
| * **TUSD Server** accepts the chunked data streams from the Android client and writes them out as completed JSON files. | ||
| * **Vector** monitors the landing directory, reads new files instantly, flattens the structure, appends an ingestion timestamp (`ingest_timestamp`), and forwards the raw event payload directly to the Kafka topic `registration-client-telemetry`. | ||
|
|
||
| ### 2. Stream Processing (`Kafka` ➔ `Spark Streaming`) | ||
|
|
||
| * **Spark Streaming** connects to the Kafka broker via a micro-batch architecture (e.g., 5-second trigger intervals). | ||
| * **Processing Tasks:** | ||
| * **Schema Enforcement:** Parses raw string payloads into strongly typed DataFrames matching the telemetry schema. | ||
| * **Data Cleansing:** Filters out malformed entries and handles missing parameters. | ||
| * **Security & Compliance:** Masks or strips out Personally Identifiable Information (PII) before the data leaves the processing boundary. | ||
|
|
||
|
|
||
|
|
||
| ### 3. Storage & Analytics (`Spark` ➔ `Database`) | ||
|
|
||
| * Validated events are written concurrently into structured tables partitioned by time (e.g., `event_date`) to optimize historical query speeds. | ||
| * Indexes are placed on critical high-cardinality fields such as `client_id`, `session_id`, and `log_level`. | ||
|
yakshithkd23 marked this conversation as resolved.
|
||
|
|
||
| ### 4. Monitoring (`Database` ➔ `Dashboard`) | ||
|
|
||
| * The visual dashboard layer maintains direct read-only access to the database. | ||
| * **Core Panels:** | ||
| * **System Health:** Active device counts, network sync latencies, and upload completion success rates. | ||
| * **Application Metrics:** UI interactions, page load speeds, and feature utilization stats. | ||
| * **Stability Matrix:** Real-time crash tracking, unhandled exceptions, and fatal error distribution grouped by client version. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Architecture Design: Telemetry Streaming Pipeline | ||
|
|
||
| This document details the end-to-end data flow and architectural components governing the telemetry backend. | ||
|
yakshithkd23 marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # This document outlines the structured JSON communication schemas established between the Flutter client application and the streaming backend ingest framework. | ||
|
yakshithkd23 marked this conversation as resolved.
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.