API & Architecture

Welcome to the API & Architecture section! This documentation provides deep technical insights into how Gonzo works internally, how it implements protocols, and how you can extend it.

Overview

This section is designed for:

  • Developers who want to understand Gonzo's internals

  • Contributors who want to add features or fix bugs

  • Integrators who want to connect Gonzo with other systems

  • Technical users who want to optimize Gonzo's performance

  • Curious minds who want to learn how it all works

What You'll Learn

Architecture

Understand Gonzo's design and structure:

  • Component organization and responsibilities

  • Data flow through the system

  • Technology stack and frameworks

  • Design patterns and decisions

  • Extension mechanisms

Start here: Architecture Overview

OTLP Protocol

Deep dive into OpenTelemetry Protocol implementation:

  • gRPC and HTTP transport details

  • OTLP log data model

  • Receiver implementation

  • Configuration and integration

  • Performance optimization

Start here: OTLP Protocol Details

Extension Points

Learn how to extend Gonzo's functionality:

  • Custom log format parsers

  • Custom skins and themes

  • AI provider integration

  • Input pipeline extensions

  • Plugin development (future)

Start here: Extension Points

Quick Navigation

For Different Audiences

If you're a new contributor:

  1. Read Architecture Overview to understand the big picture

  2. Browse the codebase structure

  3. Check Contributing Guidelines

  4. Pick a "good first issue" to work on

If you're integrating with OTLP:

  1. Review OTLP Protocol Details

  2. Check configuration examples

  3. Test with your OpenTelemetry setup

  4. See Troubleshooting if needed

If you're extending Gonzo:

  1. Explore Extension Points

  2. Review examples in the repository

  3. Create your custom formats or skins

  4. Share with the community!

If you're optimizing performance:

  1. Understand architecture from Architecture Overview

  2. Review performance considerations

  3. Profile your specific use case

  4. Adjust configuration accordingly

Architecture at a Glance

Gonzo follows a clean, modular architecture:

Key Components

Input Layer: File readers, stdin, OTLP receivers Processing Layer: Format detection, parsing, analysis Storage Layer: Buffering, frequency tracking Display Layer: Terminal UI with Bubble Tea Integration Layer: AI providers, external systems

Learn more: Architecture Overview

Technology Stack

Core Frameworks

Protocols & Standards

  • OpenTelemetry - OTLP protocol implementation

  • gRPC - High-performance RPC framework

  • Protocol Buffers - Efficient serialization

  • JSON - Data exchange format

Algorithms & Libraries

  • drain3 - Log pattern extraction

  • Go standard library - Core functionality

  • regex - Pattern matching

Learn more: Architecture Overview

Design Principles

Modularity

Components are loosely coupled and can be modified independently:

  • Input sources are pluggable

  • Parsers are format-agnostic

  • Display is separate from logic

  • AI providers are abstracted

Performance

Optimized for real-time log processing:

  • Streaming architecture

  • Bounded memory usage

  • Incremental updates

  • Efficient data structures

Extensibility

Designed to be extended:

  • Custom format parsers (YAML-based)

  • Custom skins (YAML-based)

  • AI provider abstraction

  • Configuration-driven behavior

User Experience

Terminal UI designed for efficiency:

  • Keyboard-first navigation

  • Vim-style shortcuts

  • Mouse support

  • Responsive updates

  • Clear visual hierarchy

Common Use Cases

1. Understanding the Codebase

Goal: Contribute code to Gonzo

Path:

  1. Architecture Overview - Understand structure

  2. Development Setup - Set up environment

  3. Contribution Guidelines - Follow process

2. Implementing OTLP Integration

Goal: Send logs to Gonzo via OpenTelemetry

Path:

  1. OTLP Protocol Details - Understand implementation

  2. Review configuration examples

  3. Test integration

  4. Troubleshooting - If issues

3. Creating Custom Parsers

Goal: Parse non-standard log formats

Path:

  1. Extension Points - Learn format system

  2. Study example formats

  3. Create your parser

  4. Test and share

4. Optimizing Performance

Goal: Handle high-volume logs efficiently

Path:

  1. Architecture Overview - Understand data flow

  2. Review performance sections

  3. Adjust buffer sizes and intervals

  4. Profile and tune

Technical Specifications

System Requirements

Runtime:

  • Go 1.21 or higher (if building from source)

  • Modern terminal with Unicode support

  • 256 color support recommended

Resources:

  • CPU: Minimal (scales with log volume)

  • Memory: Configurable (default ~50MB)

  • Network: Optional (for OTLP receiver)

Supported Platforms

  • Linux: All major distributions

  • macOS: 10.15 and later

  • Windows: Windows 10+ (WSL recommended)

Protocol Support

  • OTLP: v1.0.0+ (gRPC and HTTP)

  • JSON: Standard JSON format

  • Logfmt: Key=value format

  • Plain Text: Basic text logs

  • Custom: User-defined formats

Performance Characteristics

Throughput

Typical performance (depends on hardware and configuration):

  • Low volume: <100 logs/sec - Default settings work well

  • Medium volume: 100-1,000 logs/sec - May need tuning

  • High volume: 1,000-10,000 logs/sec - Requires optimization

  • Very high: >10,000 logs/sec - Consider sampling or filtering

Memory Usage

Baseline: ~20-30 MB With 1,000 log buffer: ~30-50 MB With 10,000 log buffer: ~100-200 MB Factors: Log size, attributes, word frequency tracking

Latency

Display updates: Configurable (default 1 second) OTLP ingestion: <10ms per log AI analysis: 1-5 seconds (depends on provider) Search/filter: Near-instant (<100ms)

API Stability

Current Status

Version: 0.1.x (Early stages)

Stability:

  • CLI Interface: Stable, unlikely to change

  • Configuration Format: Stable

  • OTLP Protocol: Stable (follows OpenTelemetry spec)

  • Internal APIs: May change between versions

  • Extension APIs: Evolving (formats and skins are stable)

Versioning

Gonzo follows Semantic Versioningarrow-up-right:

  • Major (x.0.0): Breaking changes

  • Minor (0.x.0): New features (backward compatible)

  • Patch (0.0.x): Bug fixes (backward compatible)

Future Direction

Planned Enhancements

Near-term:

  • Enhanced OTLP features

  • Additional AI providers

  • Performance optimizations

  • More built-in formats

Medium-term:

  • Plugin system architecture

  • REST API for remote control

  • Web-based interface option

  • Advanced analytics

Long-term:

  • Distributed log analysis

  • Clustering and aggregation

  • Machine learning integration

  • Enterprise features

See Changelog and Roadmaparrow-up-right for details.

Getting Help

Documentation

  • Architecture Overview - System design

  • OTLP Protocol Details - Protocol implementation

  • Extension Points - How to extend

Community

Contributing

Want to contribute to Gonzo's architecture?

  1. Review Architecture Overview

  2. Check Development Setup

  3. Read Contribution Guidelines

Additional Resources

  • Configuration Reference - Configure Gonzo

  • Troubleshooting - Solve problems

  • Contributing - Join development

External Resources

  • OpenTelemetry: https://opentelemetry.io/

  • Bubble Tea: https://github.com/charmbracelet/bubbletea

  • Go Documentation: https://go.dev/doc/

Examples

  • Repository: https://github.com/control-theory/gonzo

  • Examples Directory: https://github.com/control-theory/gonzo/tree/main/examples

  • Discussions: https://github.com/control-theory/gonzo/discussions


Ready to Dive In?

Choose your path:

📚 Learn the architecture: Start with Architecture Overview

🔌 Implement OTLP: Jump to OTLP Protocol Details

🔧 Extend Gonzo: Explore Extension Points

💻 Contribute code: Check Contributing Guidelines

circle-info

New to the codebase? Start with the Architecture Overview to get a solid understanding of how everything fits together.

circle-check

Last updated