Files
Sampras Lopes 9df4e0193f feat(analytics): Add Clickhouse based analytics (#2988)
Co-authored-by: harsh_sharma_juspay <harsh.sharma@juspay.in>
Co-authored-by: Ivor Dsouza <ivor.dsouza@juspay.in>
Co-authored-by: Chethan Rao <70657455+Chethan-rao@users.noreply.github.com>
Co-authored-by: nain-F49FF806 <126972030+nain-F49FF806@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: akshay.s <akshay.s@juspay.in>
Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com>
2023-11-29 11:34:53 +00:00
..

Starting the containers

In our use case we rely on kafka for ingesting events. hence we can use docker compose to start all the components

docker compose up -d clickhouse-server kafka-ui

kafka-ui is a visual tool for inspecting kafka on localhost:8090

Setting up Clickhouse

Once clickhouse is up & running you need to create the required tables for it

you can either visit the url (http://localhost:8123/play) in which the clickhouse-server is running to get a playground Alternatively you can bash into the clickhouse container & execute commands manually

# On your local terminal
docker compose exec clickhouse-server bash

# Inside the clickhouse-server container shell
clickhouse-client --user default

# Inside the clickhouse-client shell
SHOW TABLES;
CREATE TABLE ......

The table creation scripts are provided here

Running/Debugging your application

Once setup you can run your application either via docker compose or normally via cargo run

Remember to enable the kafka_events via development.toml/docker_compose.toml files

Inspect the kafka-ui to check the messages being inserted in queue

If the messages/topic are available then you can run select queries on your clickhouse table to ensure data is being populated...

If the data is not being populated in clickhouse, you can check the error logs in clickhouse server via

# Inside the clickhouse-server container shell
tail -f /var/log/clickhouse-server/clickhouse-server.err.log