Skip to content

ObserveRTC/schemas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ObserveRTC Schemas

License

A comprehensive schema generator for WebRTC observability that creates type-safe language bindings and data structures for monitoring and analyzing WebRTC applications.

Table of Contents

Overview

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.

Features

  • πŸ“Š 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

Generated Projects

The schema generator produces several standalone npm packages and output formats:

NPM Packages

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/

Database Schemas

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/

Other Formats

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/

Schema Structure

The schemas are organized into several main sample types:

Core 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

Nested 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

Key Features

  • 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

Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Setup

git clone https://github.com/observertc/schemas.git
cd schemas
npm install

Code Generation

Generate all language bindings and output formats from the Avro schema definitions:

node index.js

This command will:

  1. Read and validate the Avro schema files from sources/samples/
  2. Generate TypeScript/JavaScript type definitions and npm packages
  3. Create SQL table schemas for BigQuery, Redshift, and PostgreSQL
  4. Generate Protocol Buffer definitions for cross-language serialization
  5. Create CSV format specifications and column headers
  6. Compile Avro schemas for runtime validation
  7. 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/ and npm-samples-decoder/
  • Database-specific DDL statements in outputs/sql/
  • Protocol Buffer .proto files in outputs/proto/
  • CSV specifications in outputs/csv/

Building All Outputs

Generate all language bindings and formats:

npm run compile

This will:

  1. Process Avro schema definitions in sources/samples/
  2. Generate TypeScript types and npm packages
  3. Create SQL table schemas for multiple databases
  4. Generate Protocol Buffer definitions
  5. Create CSV format specifications

Project Structure

β”œβ”€β”€ 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

Adding New Fields

  1. Edit the appropriate .avsc file in sources/samples/
  2. Add documentation for the new field
  3. Run npm run compile to regenerate all outputs
  4. Test the generated code
  5. Update version numbers as appropriate

Schema Guidelines

  • 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

Versioning

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

Current Version: 3.0.0

Based on WebRTC Statistics API specifications and optimized for real-world WebRTC monitoring scenarios.

Contributing

We welcome contributions! Please follow these steps:

Getting Started

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes to the schema files in sources/
  4. Run the build: npm run compile
  5. Test all generated outputs
  6. Commit your changes: git commit -m 'Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. Open a Pull Request

Code Style

  • 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

License

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.

About

ObserveRTC schema

Resources

License

Stars

Watchers

Forks

Packages

No packages published