Skip to content

rtcstats/rtcstats

Repository files navigation

rtcstats monorepo

This is a monorepo for rtcstats-js (clientside monitoring), rtcstats-server (serverside dump collection) and the updated dump-importer (supporting rtcstats and webrtc-internals formats).

It is part of a bigger offering that includes rtcstats.com, an online service for debugging and troubleshooting WebRTC statistics.

A typical RTCStats deployment

A full rtcstats-based deployment consists of

  • a clientside SDK (rtcstats-js) to collect the data.
  • a server-side component (rtcstats-server) acting as endpoint for collecting the data generated by the clientside SDK as a dump. This is backed by both
    • backend storage, e.g. Amazon S3 or compatible APIs.
    • A database for storing metadata about the dumps and features extracted from the dumps.
  • a server-side component (rtcstats-features) processing the dumps and extracting the features.

Since metrics gathering is not time-critical, rtcstats-server can be deployed centrally in a single location. Multiple instances writing to the same storage and database can be used to scale the metrics gathering horizontally. The scaling properties for this are CPU load, disk usage and the number of concurrent websocket connections.

Feature extraction using rtcstats-features happens "offline" and separated from the main server, as experience has shown that this process is more CPU and memory intensive than the data collection. Like rtcstats-server, any number of rtcstats-features instances can process records in a single database. Since the location does not matter and is not time-sensitive this can happen in cheap regions or during a service's off-peak hours when there is spare compute resources available.

The system architecture is shown below:

       +-----------------+
       |   rtcstats-js   |
       |  (client-side)  |
       +--------+--------+
                |
                | Data Collection
                |
       +--------v----------+
       |  rtcstats-server  | (1..N)
       +-------------------+
                |
       +--------+----------+
       |                   |
+------v-------+    +------v--------+      +------------------+
|   Database   |    |    Storage    |<-----|  Visualization   |
|  (Postgres)  |    |   (e.g. S3)   |      |  (rtcstats.com)  |
+------^-------+    +------^--------+      +------------------+
       |                   |
       |  Dump Processing  |
       +--------+----------+
                |
       +--------v----------+
       | rtcstats-features | (1..M)
       +-------------------+

End-to-end example

To start the local example version, run

npm install
npm start --workspace=example

This will start a minimal server, open a browser window, run some WebRTC-related API calls. Once done, a RTCStats dump file can be found in the example/upload/ directory which can be imported on RTCStats or the built-in dump importer.

Building

Running

npm test

will run linting and unit/e2e tests in all sub-packages.

Previous versions

This repository contains the current version of the legacy rtcstats-js and rtcstats-server. The old versions are no longer maintained, friendly forks such as the Jitsi one exist.

We invite you to use this version. We plan on keeping it well maintained, modernized and well behaved for all WebRTC applications.