How routerarchitects/ra-wlan-cloud-analytics works
Purpose and entry points
OWANALYTICS is a C++ OpenWiFi/Mango Cloud microservice that ingests AP telemetry, derives device/venue/client metrics, persists historical analytics, and exposes them through REST APIs. Build and process entry wiring are centered on CMakeLists.txt, src/Daemon.cpp, and src/framework/MicroService.cpp. Its public contract is openapi/owanalytics.yaml.
Service runtime and network boundary
The daemon runs three configurable interfaces: public REST (default 16009), internal REST (17009), and ALB health checks (16109). The framework separates public/internal servers and load-balancer health handling in src/framework/RESTAPI_ExtServer.cpp, src/framework/RESTAPI_IntServer.cpp, and src/framework/ALBserver.cpp. Configuration is supplied through owanalytics.properties (with template owanalytics.properties.tmpl).
Telemetry ingestion and event coordination
Kafka is the primary asynchronous integration boundary for device telemetry and microservice coordination. src/framework/KafkaManager.cpp and src/framework/EventBusManager.cpp provide messaging infrastructure; topic definitions reside in src/framework/KafkaTopics.h. Domain receivers—src/DeviceStatusReceiver.cpp, src/HealthReceiver.cpp, and src/StateReceiver.cpp—consume and interpret AP status, health, and state streams.
Analytics aggregation and lifecycle
src/APStats.cpp is the core AP-statistics aggregation model. src/Dashboard.cpp and src/VenueCoordinator.cpp organize telemetry into operational/venue-level views, while src/VenueWatcher.cpp tracks venue-related changes. A likely primary flow is: Kafka telemetry → receivers → AP/client/venue aggregation → storage and API-visible summaries.
Client telemetry and historical persistence
Wi-Fi client association and radio/bandwidth history are maintained through src/WifiClientCache.cpp and persisted by src/storage/storage_wificlients.cpp. Device and time-series persistence are separated into src/storage/storage_boards.cpp and src/storage/storage_timepoints.cpp; src/StorageService.cpp coordinates the storage layer. PostgreSQL and MySQL are material build/runtime integration points, indicated by cmake/FindPostgreSQL.cmake and cmake/FindMySQL.cmake.
API composition and downstream integrations
Analytics REST routing is centralized in src/RESTAPI/RESTAPI_routers.cpp. Board/device, timepoint, and client-history query handlers live in src/RESTAPI/RESTAPI_board_handler.cpp, src/RESTAPI/RESTAPI_board_timepoint_handler.cpp, and src/RESTAPI/RESTAPI_wificlienthistory_handler.cpp. Typed request/response models for peer OpenWiFi services are in src/RESTObjects/, while src/framework/AuthClient.cpp enforces intra-service authentication via OWSEC tokens and src/sdks/SDK_prov.cpp integrates provisioning context.
Deployment and operations
The service is containerized by Dockerfile and docker-entrypoint.sh, with PostgreSQL startup coordination in wait-for-postgres.sh. Kubernetes deployment is packaged as a Helm chart, primarily helm/templates/deployment.yaml, helm/templates/service.yaml, and helm/templates/ingress.yaml. The system runs within the broader OWSDK ecosystem, notably OWGW as telemetry/controller source, OWSEC for auth, and OWPROV for provisioning/venue relationships.
Main entry points: StorageService.cpp Storage Service · RESTAPI_routers.cpp Analytics API Router · MicroService.cpp Microservice Framework · APStats.cpp AP Statistics
Components 20
Service Runtime
- CMake Build
CMakeLists.txt - Daemon · Starts the analytics microservice.
src/Daemon.cpp - Microservice Framework · Owns service lifecycle and wiring.
src/framework/MicroService.cpp - REST Server Interfaces · Separates public, internal, and ALB health endpoints.
src/framework/RESTAPI_ExtServer.cpp
Telemetry Ingestion
- Kafka Event Bus · Primary asynchronous telemetry and coordination boundary.
src/framework/KafkaManager.cpp - Kafka Topics
src/framework/KafkaTopics.h - Telemetry Receivers · Interprets device status, health, and state streams.
src/DeviceStatusReceiver.cpp
Analytics
- AP Statistics · Core AP and client telemetry aggregation.
src/APStats.cpp - Venue Analytics · Builds operational and venue-level views.
src/VenueCoordinator.cpp - Wi-Fi Client Cache · Maintains association, radio, and bandwidth history.
src/WifiClientCache.cpp
Historical Storage
- Storage Service · Coordinates device, time-series, and client persistence.
src/StorageService.cpp - Client History Storage
src/storage/storage_wificlients.cpp - Device & Time-Series Storage
src/storage/storage_timepoints.cpp - PostgreSQL / MySQL · Runtime historical analytics stores.
API & Integrations
- Analytics API Router · Composes analytics query endpoints.
src/RESTAPI/RESTAPI_routers.cpp - Analytics Query Handlers · Serves board, timepoint, and client-history queries.
src/RESTAPI/RESTAPI_board_handler.cpp - OWSEC Auth Client · Uses OWSEC tokens for intra-service authentication.
src/framework/AuthClient.cpp - OWPROV SDK · Obtains provisioning and venue context.
src/sdks/SDK_prov.cpp - OpenAPI Contract
openapi/owanalytics.yaml
Deployment
- Container & Helm Deployment · Packages the service and Kubernetes resources.
Dockerfile
Connections 22
- CMake Build → Daemon: builds
- Daemon → Microservice Framework: starts
- Microservice Framework → REST Server Interfaces: hosts
- Microservice Framework → Kafka Event Bus: initializes
- Kafka Topics → Kafka Event Bus: defines
- Kafka Event Bus → Telemetry Receivers: telemetry events
- Telemetry Receivers → AP Statistics: updates
- AP Statistics → Venue Analytics: aggregates into
- AP Statistics → Wi-Fi Client Cache: updates client history
- Venue Analytics → Storage Service: persists summaries
- Wi-Fi Client Cache → Storage Service: persists history
- Storage Service → Client History Storage: writes
- Storage Service → Device & Time-Series Storage: writes
- Client History Storage → PostgreSQL / MySQL: stores in
- Device & Time-Series Storage → PostgreSQL / MySQL: stores in
- REST Server Interfaces → Analytics API Router: routes requests
- Analytics API Router → Analytics Query Handlers: dispatches
- Analytics Query Handlers → Storage Service: queries historical data
- Analytics API Router → OpenAPI Contract: implements
- Analytics API Router → OWSEC Auth Client: authenticates
- Venue Analytics → OWPROV SDK: gets venue context
- Container & Helm Deployment → Daemon: deploys