A comprehensive schema generator for WebRTC observability that creates type-safe language bindings and data structures for monitoring and analyzing WebRTC applications.
ObserveRTC Schemas provides a standardized way to describe WebRTC statistics, events, and metrics across different programming languages and data storage systems. The schema generator processes Avro schema definitions and creates type-safe bindings for TypeScript/JavaScript, SQL schemas for databases, and other format outputs.
- π Comprehensive WebRTC Stats Coverage - Complete schema definitions for all WebRTC statistics
- π§ Multi-Language Support - Generates TypeScript/JavaScript, SQL, CSV, and Protocol Buffer bindings
- π‘οΈ Type Safety - Provides full type safety across all generated languages
- π Real-time Monitoring - Optimized for real-time WebRTC observability and monitoring
- π Version Controlled - Semantic versioning with clear upgrade paths
- ποΈ Extensible Architecture - Support for custom fields and extensions
The schema generator produces several standalone npm packages and output formats:
Package | Description | Repository |
---|---|---|
@observertc/schemas |
Core TypeScript/JavaScript type definitions | ./npm-samples-lib/ |
@observertc/samples-encoder |
Binary encoding utilities for samples | ./npm-samples-encoder/ |
@observertc/samples-decoder |
Binary decoding utilities for samples | ./npm-samples-decoder/ |
Format | Description | Location |
---|---|---|
BigQuery | Google BigQuery table schemas | outputs/sql/bigquery/ |
Redshift | Amazon Redshift table definitions | outputs/sql/redshift/ |
PostgreSQL | Standard SQL DDL statements | outputs/sql/postgresql/ |
Format | Description | Location |
---|---|---|
Protocol Buffers | .proto files for cross-language serialization |
outputs/proto/ |
CSV | Column headers and format specifications | outputs/csv/ |
Avro | Compiled Avro schema definitions | outputs/avsc/ |
The schemas are organized into several main sample types:
Schema | Description |
---|---|
ClientSample |
End-user client statistics and metrics |
PeerConnectionSample |
WebRTC peer connection statistics |
SfuSample |
Selective Forwarding Unit (SFU) metrics |
TurnSample |
TURN server statistics |
- RTP Statistics - Inbound/outbound RTP stream metrics
- ICE Statistics - ICE candidate and transport information
- Media Statistics - Audio/video codec and quality metrics
- Transport Statistics - Network transport layer information
- Score Fields - Quality scoring with detailed reasoning (
score
+scoreReasons
) - Extensible Attachments - Custom metadata support via
attachments
fields - Timestamp Precision - High-resolution timing information
- Comprehensive Coverage - All WebRTC standard statistics
- Node.js 16+
- npm or yarn
git clone https://github.com/observertc/schemas.git
cd schemas
npm install
Generate all language bindings and output formats from the Avro schema definitions:
node index.js
This command will:
- Read and validate the Avro schema files from
sources/samples/
- Generate TypeScript/JavaScript type definitions and npm packages
- Create SQL table schemas for BigQuery, Redshift, and PostgreSQL
- Generate Protocol Buffer definitions for cross-language serialization
- Create CSV format specifications and column headers
- Compile Avro schemas for runtime validation
- Output all generated files to their respective directories in
outputs/
The generator processes the schema definitions and creates:
- Type-safe TypeScript interfaces in
npm-samples-lib/
- Binary encoder/decoder utilities in
npm-samples-encoder/
andnpm-samples-decoder/
- Database-specific DDL statements in
outputs/sql/
- Protocol Buffer
.proto
files inoutputs/proto/
- CSV specifications in
outputs/csv/
Generate all language bindings and formats:
npm run compile
This will:
- Process Avro schema definitions in
sources/samples/
- Generate TypeScript types and npm packages
- Create SQL table schemas for multiple databases
- Generate Protocol Buffer definitions
- Create CSV format specifications
βββ sources/ # Source Avro schema definitions
β βββ samples/ # Sample schema files (.avsc)
βββ outputs/ # Generated outputs
β βββ typescript/ # Generated TS/JS code
β βββ sql/ # Database schemas
β βββ proto/ # Protocol Buffer files
β βββ csv/ # CSV format specs
β βββ avsc/ # Compiled Avro schemas
βββ npm-samples-lib/ # Generated core TypeScript library
βββ npm-samples-encoder/ # Generated encoding utilities
βββ npm-samples-decoder/ # Generated decoding utilities
βββ scripts/ # Build and generation scripts
- Edit the appropriate
.avsc
file insources/samples/
- Add documentation for the new field
- Run
npm run compile
to regenerate all outputs - Test the generated code
- Update version numbers as appropriate
- All fields should have clear documentation
- Use appropriate Avro types (
null
unions for optional fields) - Follow naming conventions (camelCase for field names)
- Add
attachments
field for extensibility where appropriate
ObserveRTC Schemas uses Semantic Versioning with the following conventions:
- MAJOR.MINOR.PATCH format
- PATCH - Library bugfixes and improvements
- MINOR - New fields, schema updates (typically matches WebRTC draft date: YYYYMMDD)
- MAJOR - Breaking changes to schema structure
Based on WebRTC Statistics API specifications and optimized for real-world WebRTC monitoring scenarios.
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes to the schema files in
sources/
- Run the build:
npm run compile
- Test all generated outputs
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow existing schema structure and naming conventions
- Add comprehensive documentation for new fields
- Include examples in field descriptions where helpful
- Test generated code in multiple target languages
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
ObserveRTC Schemas - The foundation for standardized WebRTC observability across languages and platforms.