diff --git a/.docker/scripts/clickhouse/001-create-tables.sql b/.docker/scripts/clickhouse/001-create-tables.sql new file mode 100644 index 0000000000..c5ec52d986 --- /dev/null +++ b/.docker/scripts/clickhouse/001-create-tables.sql @@ -0,0 +1,34 @@ +CREATE TABLE IF NOT EXISTS default.events +( + -- Shared + `id` UUID, + `orgId` String, + `userId` String, + `timestamp` Int32, + `type` String, + + -- App + `appVersion` String, + `vscodeVersion` String, + `platform` String, + `editorName` String, + `language` String, + `mode` String, + + -- Task + `taskId` Nullable(String), + `apiProvider` Nullable(String), + `modelId` Nullable(String), + `diffStrategy` Nullable(String), + `isSubtask` Nullable(Bool), + + -- Completion + `inputTokens` Nullable(Int32), + `outputTokens` Nullable(Int32), + `cacheReadTokens` Nullable(Int32), + `cacheWriteTokens` Nullable(Int32), + `cost` Nullable(Float32) +) +ENGINE = MergeTree() +ORDER BY (id, type, timestamp) +SETTINGS index_granularity = 8192; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d07928cf67..25dd62e19d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,3 +11,16 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password - POSTGRES_DATABASES=roo_code_development,roo_code_test + clickhouse: + image: clickhouse/clickhouse-server + ports: + - "8123:8123" + - "9000:9000" + volumes: + - ./.docker/clickhouse:/var/lib/clickhouse/ + - ./.docker/clickhouse-logs:/var/log/clickhouse-server/ + - ./.docker/scripts/clickhouse:/docker-entrypoint-initdb.d + environment: + - CLICKHOUSE_DB=default + - CLICKHOUSE_USER=default + - CLICKHOUSE_PASSWORD=password