Back to Lago

Lago Events Processor

events-processor/README.md

1.45.25.3 KB
Original Source

Lago Events Processor

High throughput events processor for Lago. This service is in charge of providing a post-process for events in high volume scenarios.

This service need to be configured with Clickhouse and Redpanda. Please contact us for further informations.

How to run it

With the docker compose environment:

shell
go build -o event_processors .

./event_processors

Development

Running

shell
lago up -d events-processor

Testing

shell
lago exec events-processor go test ./...

Configuration

This app requires some env vars

VariableDescription
ENVSet as production to not load .env file
DATABASE_URLPostgreSQL server URL (eg: postgresql://lago_user:lago_password@lago_server:5432/lago_db)
LAGO_KAFKA_BOOTSTRAP_SERVERSKafka Brokers list URL with port (eg: "redpanda:9092,kafka:9092")
LAGO_KAFKA_RAW_EVENTS_TOPICEvents Kafka Topic (eg: events_raw)
LAGO_KAFKA_ENRICHED_EVENTS_TOPICEvents Enriched Kafka Topic (eg: events_enriched)
LAGO_KAFKA_ENRICHED_EVENTS_EXPANDED_TOPICEvents Enriched Expanded Kafka Topic (eg: events_enriched_expanded)
LAGO_KAFKA_EVENTS_CHARGED_IN_ADVANCE_TOPICEvents Charge In Advance Kafka Topic (eg: events_charge_in_advance)
LAGO_KAFKA_EVENTS_DEAD_LETTER_TOPICEvents Dead Letter Queue (eg: events_dead_letter)
LAGO_KAFKA_CONSUMER_GROUPKafka Consumer Group Name for Post Processing
LAGO_REDIS_STORE_URLRedis URL to store subscription refresh IDs
LAGO_REDIS_CACHE_URLRedis URL to store charge usage cache entries

Additionally there's a few optional environment variables

VariableDescription
LAGO_REDIS_STORE_DBRedis database number to use for the store (default: 0)
LAGO_REDIS_STORE_PASSWORDPassword for the Redis store (if required)
LAGO_REDIS_STORE_TLSRedis TLS configuration for the Redis store (default: false)
LAGO_REDIS_CACHE_DBRedis database number to use for the cache (default: 0)
LAGO_REDIS_CACHE_PASSWORDPassword for the Redis cache (if required)
LAGO_REDIS_CACHE_TLSRedis TLS configuration for charge usage cache entries (default: false)
LAGO_KAFKA_TLSSet to true if your broker uses TLS termination
LAGO_KAFKA_SCRAM_ALGORITHMYour Broker SCRAM algo, supported values are SCRAM-SHA-256 and SCRAM-SHA-512.
If you provide a SCRAM Algo, LAGO_KAFKA_USERNAME and LAGO_KAFKA_PASSWORD are required
LAGO_KAFKA_USERNAMEIf your broker needs auth, your Kafka Username
LAGO_KAFKA_PASSWORDIf your broker needs auth, your Kafka password
OTEL_SERVICE_NAMEOpenTelemetry service name (eg: events-processor)
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry server URL. Setting this environment variable will enable tracing
OTEL_INSECURESet to true to use the insecure mode of OpenTelemetry
LAGO_USE_MEMORY_CACHEUse the new in memory cache instead of DB calls
LAGO_DEBEZIUM_TOPIC_PREFIXMandatory if USE_MEMORY_CACHE is set to true, debezium kafka topic prefix (eg: lago_dbz)