Skip to main content
Deep dive into the Bento Collector’s internals and optimization.

Architecture

The collector pipeline has three components:
  1. Input: Reads data with offset management and backpressure handling
  2. Processors: Transforms data using Bloblang mapping language
  3. Output: Batches and sends to Flexprice API with retries

How Batching Works

Events accumulate until either condition is met:
  • Count threshold: Batch reaches configured size (e.g., 10 events)
  • Time window: Time limit reached (e.g., 2 seconds)
Example timeline:
The collector automatically routes to the appropriate endpoint:
  • 1 event: POST /events
  • multiple events: POST /events/bulk

Data Transformation

Use Bloblang to transform your data format to Flexprice requirements:

Type Conversion

All property values must be strings:
Before: {"duration": 245, "status": 200}
After: {"duration": "245", "status": "200"}

Conditional Processing

Performance Optimization

Kafka Input

Output Concurrency

Guidelines:
  • Low volume: max_in_flight: 5
  • Medium volume: max_in_flight: 10 (default)
  • High volume: max_in_flight: 20-50

Error Handling

The collector automatically retries failed requests:
Retry sequence:
  1. Fail → Wait 1s → Retry
  2. Fail → Wait 2s → Retry
  3. Fail → Wait 4s → Retry
  4. Drop and log error

Observability

Metrics

Key Prometheus metrics:

Logging

Configure log level and format:

Additional Resources

Need help? support@flexprice.io