Collector: Configuration
Environment Variables
Section titled “Environment Variables”The collector is configured entirely through environment variables.
gRPC Server
Section titled “gRPC Server”| Variable | Default | Description |
|---|---|---|
GRPC_PORT | 4317 | Port for the gRPC server. The collector listens on all interfaces (0.0.0.0). |
ClickHouse Connection
Section titled “ClickHouse Connection”| Variable | Default | Description |
|---|---|---|
CLICKHOUSE_HOST | localhost | ClickHouse server hostname or IP. |
CLICKHOUSE_PORT | 8123 | ClickHouse HTTP interface port. The collector uses the HTTP protocol (not native TCP 9000). |
CLICKHOUSE_DATABASE | aires | Database name. Must exist before the collector starts. |
CLICKHOUSE_USER | default | ClickHouse username. |
CLICKHOUSE_PASSWORD | "" (empty) | ClickHouse password. |
Example
Section titled “Example”Broadway Pipeline Tuning
Section titled “Broadway Pipeline Tuning”The Broadway pipeline controls how events are batched before insertion into ClickHouse. The default configuration is in AiresCollector.Pipeline:
Pipeline Parameters
Section titled “Pipeline Parameters”| Parameter | Default | Description |
|---|---|---|
| Processor concurrency | System.schedulers_online() | Number of concurrent processors. Defaults to the number of CPU cores. Each processor transforms events from Proto to row format. |
| Batcher concurrency | 4 | Number of concurrent batcher processes. Each batcher accumulates rows and triggers ClickHouse inserts. More batchers = more parallel inserts. |
| Batch size | 1000 | Maximum rows per ClickHouse INSERT. When the batcher accumulates this many rows, it flushes immediately. |
| Batch timeout | 500 ms | Maximum time to wait before flushing a partial batch. Even if batch_size hasn’t been reached, a flush happens after this interval. |
Tuning for High Throughput
Section titled “Tuning for High Throughput”For collectors handling > 100K events/sec:
Larger batch sizes are more efficient for ClickHouse (fewer INSERT statements, better compression), but increase latency before events become queryable.
Tuning for Low Latency
Section titled “Tuning for Low Latency”For real-time dashboards where you need events queryable within seconds:
Smaller batches and shorter timeouts reduce the time between event ingestion and queryability, at the cost of more frequent (and less efficient) ClickHouse inserts.
ClickHouse Connection Pool
Section titled “ClickHouse Connection Pool”The AiresCollector.Store GenServer maintains a single connection to ClickHouse via the ch library. For high-throughput deployments, you may want to increase the connection pool:
The Ch library supports connection pooling via db_connection. To configure pool size, modify the Store initialization:
Connection Pool Guidelines
Section titled “Connection Pool Guidelines”| Deployment | Pool Size | Notes |
|---|---|---|
| Development | 1-2 | Default is sufficient |
| Staging | 5 | Moderate load |
| Production (single collector) | 10-20 | Match batcher concurrency |
| Production (multiple collectors) | 5-10 per instance | Avoid overwhelming ClickHouse |
gRPC Server Configuration
Section titled “gRPC Server Configuration”The gRPC server is configured through the GRPC.Server.Supervisor:
The server uses grpc-elixir with these defaults:
- Maximum message size: 4MB (Protobuf default)
- Keepalive: enabled
- Interceptors:
GRPC.Server.Interceptors.Logger(logs every RPC call)
Disabling Request Logging
Section titled “Disabling Request Logging”In high-throughput environments, the gRPC logger interceptor can be noisy. Remove it from the endpoint:
BEAM VM Tuning
Section titled “BEAM VM Tuning”For production deployments, tune the Erlang VM:
Monitoring
Section titled “Monitoring”The collector exposes telemetry events that can be consumed by Prometheus, StatsD, or any :telemetry-compatible backend:
| Event | Measurements | Metadata |
|---|---|---|
[:aires, :ingest, :start] | — | %{batch_size: n} |
[:aires, :ingest, :stop] | %{duration: ns} | %{accepted: n, rejected: n} |
[:aires, :insert, :start] | — | %{row_count: n} |
[:aires, :insert, :stop] | %{duration: ns} | %{row_count: n} |
[:aires, :insert, :exception] | %{duration: ns} | %{reason: term} |
Example telemetry handler: