OTLP Protocol Details
Deep dive into Gonzo's OpenTelemetry Protocol (OTLP) implementation for receiving and processing logs.
Overview
Gonzo implements a complete OTLP logs receiver supporting both gRPC and HTTP transports. This allows Gonzo to receive logs directly from OpenTelemetry SDKs, collectors, and other OTLP-compatible sources.
OTLP Specification
Gonzo follows the OpenTelemetry Protocol Specification for logs:
Version: OTLP 1.0.0+
Transports: gRPC and HTTP
Encoding: Protocol Buffers (gRPC), JSON (HTTP)
Endpoints:
gRPC:
localhost:4317HTTP:
http://localhost:4318/v1/logs
Architecture
┌─────────────────────────────────────────┐
│ OTLP Client (Sender) │
│ (App, Collector, SDK, etc) │
└──────────────┬──────────────────────────┘
│
├──────────┐
│ │
gRPC:4317 HTTP:4318
│ │
┌──────────▼────┐ ┌──▼──────────┐
│ gRPC Server │ │ HTTP Server │
│ │ │ │
└──────┬────────┘ └─┬───────────┘
│ │
└─────┬───────┘
│
┌────────▼─────────┐
│ OTLP Processor │
│ - Decode proto │
│ - Extract logs │
│ - Map fields │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Log Converter │
│ - Resource attr │
│ - Log record │
│ - Timestamps │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Analyzer │
│ Engine │
└──────────────────┘Transport Details
gRPC Transport
Endpoint: localhost:4317
Protocol: HTTP/2 with Protocol Buffers
Service Definition:
Features:
Bidirectional streaming support
Built-in compression (gzip)
Connection multiplexing
Automatic reconnection
Starting gRPC Receiver:
HTTP Transport
Endpoint: http://localhost:4318/v1/logs
Protocol: HTTP/1.1 or HTTP/2
Method: POST
Content-Type: application/json or application/x-protobuf
Features:
Standard HTTP clients work
JSON encoding (more debuggable)
No special libraries required
Works through HTTP proxies
Starting HTTP Receiver:
OTLP Log Data Model
Structure Hierarchy
Resource Attributes
Resource attributes describe the source of logs:
How Gonzo Uses Resource Attributes:
Merged with log record attributes
Displayed in Attributes panel
Available for filtering
Shown in log details
Log Record
Individual log entry:
Gonzo Mapping:
Severity Levels
OTLP defines numerical severity levels:
1-4
TRACE
⚪ White
5-8
DEBUG
🔵 Blue
9-12
INFO
🟢 Green
13-16
WARN
🟡 Yellow
17-20
ERROR
🔴 Red
21-24
FATAL
🔴 Red
Gonzo reads both severityNumber and severityText fields.
Body Types
The log body can be various types:
String (most common):
Structured:
Gonzo handles all OTLP value types and displays them appropriately.
Configuration Examples
OpenTelemetry Collector
Configure collector to send to Gonzo:
Start collector and Gonzo:
Application SDK Integration
Python Example:
Go Example:
Node.js Example:
HTTP API Reference
POST /v1/logs
Request Format (JSON):
Response (Success):
Response (Partial Failure):
Status Codes:
200 OK- All logs accepted206 Partial Content- Some logs rejected (see partialSuccess)400 Bad Request- Invalid request format500 Internal Server Error- Server error
Testing HTTP Endpoint
gRPC API Reference
Service: opentelemetry.proto.collector.logs.v1.LogsService
Method: Export
Request: ExportLogsServiceRequest
Response: ExportLogsServiceResponse
Protocol Buffers Definition:
Testing gRPC Endpoint
Performance & Optimization
Batching
Gonzo processes logs in batches for efficiency:
Incoming Batches:
OTLP senders should batch logs (recommended 100-1000 per batch)
Reduces network overhead
Improves throughput
Internal Processing:
Logs processed individually after receipt
Real-time display without buffering delay
Concurrency
gRPC Handler:
Concurrent request handling
One goroutine per connection
Thread-safe log ingestion
HTTP Handler:
Standard HTTP server concurrency
Multiple simultaneous POST requests supported
Memory Management
Bounded Buffers:
OTLP messages are streamed, not accumulated
Converted logs go to main log buffer (configurable size)
No unlimited memory growth
Large Messages:
Default max receive message size: 4MB (configurable)
Larger messages can be split by sender
Security Considerations
TLS/SSL
Production Recommendation: Always use TLS in production.
Current Implementation:
gRPC: Insecure mode (no TLS)
HTTP: Plain HTTP
For Production Use:
Run Gonzo behind TLS-terminating proxy (nginx, envoy)
Use OTLP collector with TLS, forward to Gonzo locally
Example with nginx:
Authentication
Current Implementation: No built-in authentication
Recommendations:
Use in trusted networks only
Deploy behind authenticated proxy
Use firewall rules to restrict access
Consider VPN for remote access
Network Isolation
Best Practice: Don't expose OTLP ports to public internet
Troubleshooting OTLP Issues
Connection Refused
Symptom: Sender can't connect to Gonzo
Checks:
Logs Not Appearing
Symptom: Connection works but no logs in Gonzo
Diagnosis:
Check request format matches OTLP spec
Verify severityText or severityNumber is set
Check body field is present
Look for error responses from Gonzo
Test with minimal payload:
Message Size Exceeded
Symptom: "message size exceeded" errors
Solution:
Reduce batch size in sender
Split large log messages
Currently no config option (fixed at 4MB)
Performance Issues
Symptom: Slow log processing or high CPU
Solutions:
Compatibility
OTLP Version Support
Specification Version: 1.0.0+
Protocol Version: v1
Backward Compatibility: Follows semantic versioning
OpenTelemetry SDK Compatibility
Tested with:
✅ OpenTelemetry Collector v0.90+
✅ Python SDK v1.20+
✅ Go SDK v1.20+
✅ Node.js SDK v0.45+
✅ Java SDK v1.32+
✅ .NET SDK v1.6+
Transport Support Matrix
gRPC
Protobuf
✅ Supported
HTTP
JSON
✅ Supported
HTTP
Protobuf
✅ Supported
WebSocket
-
❌ Not supported
Future Enhancements
Planned Features:
TLS support (direct, without proxy)
Authentication (API keys, mTLS)
Compression (gzip, zstd)
Configurable message size limits
Metrics export (self-monitoring)
Multiple OTLP receivers (different ports for different sources)
Resources
Specifications
OpenTelemetry Documentation
Related Gonzo Docs
Architecture Overview
Common Issues - OTLP
Configuration Reference
Quick Start: gonzo --otlp-enabled starts both gRPC (4317) and HTTP (4318) receivers. Point your OTLP exporter to these endpoints and logs will appear in Gonzo immediately!
Last updated