Getting Started with WDP
Waddling Diagnostic Protocol - Quick start guide and overview
Abstract#
The Waddling Diagnostic Protocol (WDP) is a comprehensive, structured error coding system designed for modern distributed systems. It provides:
- Structured, semantic error codes for human readability and debugging
- Compact IDs for efficient network transmission and storage
- Multi-language support through catalog-based expansion
- Namespace isolation for multi-service architectures
- Offline capability through client-side catalog caching
- Efficient wire format with minimal transmission overhead
WDP solves the challenge of creating error codes that are both meaningful to developers and efficient for systems.
Quick Example#
Traditional approach:
{
"error": {
"code": "E.AUTH.TOKEN.EXPIRED",
"message": "Token expired at 2024-01-15T10:30:00Z",
"description": "The JWT token has exceeded its TTL."
}
}WDP approach:
{
"xY9Kp": {
"f": {"timestamp": "2024-01-15T10:30:00Z"}
}
}Client expands xY9Kp using a pre-downloaded catalog to display:
โ Error: Token expired at 2024-01-15T10:30:00Z
๐ก Use /auth/refresh endpoint with refresh tokenWDP separates the error identity (compact ID) from the error description (catalog). This enables efficient transmission while maintaining rich error information.
Recommended Reading Order#
1. Start Here
- Overview (STRUCTURE) โ Overview of the 5-part error code structure
2. Core Specifications (Parts 1-5)
- 1-SEVERITY โ Severity levels (E, W, C, I, H, etc.)
- 2-COMPONENT โ System module identification
- 3-PRIMARY โ Failure domain within component
- 4-SEQUENCE โ Specific error instance numbering
- 5-COMPACT-IDS โ Hash-based compact identifiers
3. Conventions
- 6-SEQUENCE-CONVENTIONS โ Sequence numbering best practices
4. Multi-Service Support
- 7-NAMESPACES โ Namespace collision prevention
5. Internationalization
- 8-I18N โ Multi-language support
6. Catalog System (Part 9)
- 9-CATALOGS โ Overview of catalog system
- 9a-CATALOG-FORMAT โ JSON catalog file format
- 9b-WIRE-PROTOCOL โ HTTP wire protocol
- 9c-IMPLEMENTATION โ Practical implementation guide
7. User Experience
- 10-PRESENTATION โ UI/UX guidelines for displaying diagnostics
8. Security & Metadata
- 11-SECURITY โ Security considerations and PII handling
- 12-METADATA โ Additional diagnostic metadata
Architecture#
The 5-Part Structure
Every WDP error code consists of five parts:
E.Auth.Token.001 โ xY9Kp
โ โ โ โ โ
โ โ โ โ โโ Part 5: Compact ID (5-char hash)
โ โ โ โโโโโโโโโ Part 4: Sequence (001)
โ โ โโโโโโโโโโโโโโโ Part 3: Primary (Token)
โ โโโโโโโโโโโโโโโโโโโโ Part 2: Component (Auth)
โโโโโโโโโโโโโโโโโโโโโโ Part 1: Severity (E = Error)Dual representation:
- Parts 1-4: Human-readable structured code (
E.AUTH.TOKEN.001) - Part 5: Machine-friendly compact ID (
xY9Kp)
Both identify the same diagnostic but serve different purposes.
Catalog-Based Expansion
WDP uses a catalog system to enable efficient transmission:
โโโโโโโโโโโโโโโโโโโ
โ Server โ Sends: {"xY9Kp": {"f": {"timestamp": "..."}}}
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Client โ 1. Downloads catalog once (cached)
โ + Catalog โ 2. Looks up xY9Kp โ full metadata
โ โ 3. Interpolates fields
โ โ 4. Displays: "Token expired at ..."
โโโโโโโโโโโโโโโโโโโBenefits:
- Compact wire format with efficient transmission
- Offline expansion capability
- Multi-language support (different catalogs per language)
- Consistent error identification across services
Namespace Support
For multi-service architectures, WDP supports namespaces to prevent collision:
Single-namespace catalog (90% of use cases):
{
"namespace": "auth_service",
"diags": {
"xY9Kp": {"code": "E.Auth.Token.001", ...}
}
}Aggregated catalog (monitoring, gateways):
{
"namespaces": {
"auth_service": "h4tYw2",
"payment_service": "k9Px3a"
},
"diags": {
"h4tYw2-xY9Kp": {"code": "E.Auth.Token.001", ...},
"k9Px3a-mN3Yr": {"code": "E.Payment.Invalid.001", ...}
}
}See 7-NAMESPACES for details.
Use Cases#
1. IoT Devices
Problem: Constrained bandwidth and battery
Solution: Send 5-character compact IDs instead of full error messages
Sensor โ {"xY9Kp": {"f": {"temp": "45.2"}}}
Gateway expands โ "Temperature 45.2ยฐC exceeds threshold"2. Mobile Applications
Problem: Slow/expensive mobile networks
Solution: Download catalog once, expand errors locally
1. App downloads catalog (cached for 7 days)
2. API returns compact diagnostics
3. App expands locally (works offline)
4. Supports multiple languages3. Microservices Architecture
Problem: High-volume logging across distributed services
Solution: Compact log entries with efficient aggregation
Service A: [xY9Kp] Auth failure
Service B: [xY9Kp] Auth failure
Service C: [xY9Kp] Auth failure
โ Centralized logging aggregates by compact ID4. Multi-Language Support
Problem: Supporting multiple languages efficiently
Solution: Same compact IDs, different language catalogs
Backend โ {"xY9Kp": {"f": {"timestamp": "2024-01-15"}}}
English client: "Token expired at 2024-01-15"
Spanish client: "Token expirรณ el 2024-01-15"
Japanese client: "ใใผใฏใณใฎๆๅนๆ้ใๅใใพใใ 2024-01-15"Key Features#
| Feature | Description |
|---|---|
| Structured & Semantic | Five-part structure: Severity.Component.Primary.Sequence with human-readable codes |
| Compact & Efficient | 5-character Base62 hash IDs with O(1) catalog lookups |
| Internationalization | Catalog-based message expansion, same compact ID for all languages |
| Multi-Service Ready | Namespace support for collision prevention, aggregated catalogs |
| Offline Capable | Client-side catalog caching, works without network |
| Developer Friendly | Clear severity levels, actionable hints, consistent attribution |
Conformance Levels#
WDP defines three conformance levels:
| Level | Name | Description |
|---|---|---|
| Level 0 | Error Codes (Basic) | Implement Parts 1-4 (structured codes). Minimum viable implementation. |
| Level 1 | Compact IDs (Standard) | Level 0 + Part 5 (compact ID generation). Recommended for most applications. |
| Level 2 | Extended (Full) | Level 1 + Parts 6-12 (catalogs, namespaces, i18n, etc.). Required for multi-service, high-scale systems. |
Status#
This specification is currently in DRAFT status. All documents are subject to change based on implementation feedback and community discussion.
| Field | Value |
|---|---|
| Current Version | 0.1.0-draft |
| Target Stable Version | 1.0.0 |
| License | CC BY 4.0 |
Specification Stability
For version 0.1.0-draft, specification parts are classified by stability:
| Classification | Parts | Description |
|---|---|---|
| Stable | 1-5 | Core protocol (Severity, Component, Primary, Sequence, Compact ID). Breaking changes unlikely. |
| Provisional | 7-9, 11-12 | Well-designed but may evolve. Catalog format includes version field for migration. |
| Informative | 6, 10 | Non-normative guidance. May change freely. |
Contributing#
We welcome contributions! Please see the contributing guidelines for details.
Ways to Contribute
- Report issues or suggest improvements
- Propose new features or extensions
- Share implementation feedback
- Improve documentation and examples
Quick Links
- GitLab Repository: gitlab.com/AshutoshMahala/wdp-specs
- Issues: gitlab.com/AshutoshMahala/wdp-specs/-/issues