Skip to content

clickhouse support for log_store - #4748

Merged
akshaydeo merged 1 commit into
devfrom
06-28-clickhouse_support_for_log_store
Jul 5, 2026
Merged

clickhouse support for log_store#4748
akshaydeo merged 1 commit into
devfrom
06-28-clickhouse_support_for_log_store

Conversation

@akshaydeo

@akshaydeo akshaydeo commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds ClickHouse as a supported log store backend, enabling high-throughput, append-only OLAP storage for Bifrost request logs, MCP tool logs, and async jobs. This provides a scalable alternative to SQLite and Postgres for analytics-heavy deployments.

Changes

  • New ClickHouseLogStore: Implements the LogStore interface using ReplacingMergeTree tables with a connection-level final = 1 setting so reads transparently see the latest version of each row. Inserts are plain (no ON CONFLICT); idempotency is handled by RMT dedup.
  • Read-modify-write (RMW) updates: Since ClickHouse has no cheap UPDATE, mutations re-read the existing row, apply the patch, and re-insert with a higher ver (defaulted to now64(9)). Per-row shard locks prevent concurrent updaters on the same pod from silently dropping each other's patches.
  • Schema migrations: clickhousemigrate.go derives column definitions from GORM-parsed struct schemas and runs idempotent CREATE TABLE IF NOT EXISTS + ALTER TABLE ... ADD COLUMN IF NOT EXISTS migrations. No migration ledger is needed since both DDL statements are inherently concurrency-safe. Cluster-mode DDL (ON CLUSTER) and ReplicatedReplacingMergeTree are supported via the optional cluster config field.
  • Dialect-aware SQL: Extracted a unixBucketExpr helper in dialectsql.go that returns the correct unix-bucket expression per dialect (SQLite, MySQL, Postgres, ClickHouse), eliminating repeated per-dialect switch blocks across all histogram queries. ClickHouse-specific JSON functions (isValidJSON, JSONExtractString) and quantile() aggregates replace Postgres/SQLite equivalents in filter, stats, and latency histogram paths.
  • DSN builder: buildClickHouseDSN supports native (port 9000/9440) and HTTP (port 8123/8443) protocols, TLS, credentials, custom dial timeout, and passes final=1 and mutations_sync=1 as connection-level settings.
  • driver.Valuer on custom string types: AsyncJobStatus and RequestType now implement driver.Valuer so the clickhouse-go batch insert path can serialize them correctly.
  • Example configs: Added withclickhouselogstore and withclickhouselogstorehttp example configs for native and HTTP protocol setups.
  • Docker Compose: Added a clickhouse service (native on host port 9001, HTTP on 8123) to framework/docker-compose.yml for local development and integration tests.
  • Config schema: config.schema.json updated to include clickhouse as a valid logs_store.type with full property documentation.
  • Makefile fix: Framework test loop now runs each package in a subshell so a failing package no longer aborts the loop; a sentinel file tracks failures and exits non-zero after the summary is printed. Absolute paths via $(CURDIR) fix JUnit report paths when cd changes the working directory.
  • .gitignore consolidation: Merged several scattered .gitignore files (UI, plugin, CLI, semantic cache) into the root .gitignore.
  • Integration tests: clickhousestore_test.go covers create, idempotent insert, batch insert, map/struct updates, dedup key protection, concurrent RMW correctness, bulk cost backfill, search/stats, delete, TTL-based batch delete, MCP tool logs, async jobs, and all histogram types. Tests skip automatically when ClickHouse is unavailable.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Start the framework Docker Compose stack (includes the new ClickHouse service):

cd framework
docker compose up -d clickhouse

Run the ClickHouse integration tests:

cd framework
go test ./logstore/... -run TestClickHouse -v

Run the full framework test suite:

make test-framework

To test end-to-end with the example config:

# Native protocol (port 9001)
cp examples/configs/withclickhouselogstore/config.json /path/to/bifrost/config.json

# HTTP protocol (port 8123)
cp examples/configs/withclickhouselogstorehttp/config.json /path/to/bifrost/config.json

New logs_store config fields for ClickHouse:

Field Type Default Description
host string required ClickHouse host
port string protocol default 9000 (native), 8123 (http)
database string default Database name
username string Username
password string Password
protocol native|http native Wire protocol
secure bool false Enable TLS
dial_timeout int (ms) 10000 Connection dial timeout
cluster string ON CLUSTER name for replicated deployments

Breaking changes

  • Yes
  • No

Related issues

Security considerations

ClickHouse credentials are handled via schemas.SecretVar (consistent with existing Postgres/SQLite config patterns). The cluster field is identifier-escaped before interpolation into DDL to prevent injection via config. No new secrets are introduced beyond what operators supply in their config.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 421a8ea7-d1b6-44ed-bced-529cc5d9d6ce

📥 Commits

Reviewing files that changed from the base of the PR and between 3dbfd57 and 599ad8a.

⛔ Files ignored due to path filters (3)
  • framework/go.sum is excluded by !**/*.sum
  • tests/cmd/e2eseed/go.sum is excluded by !**/*.sum
  • tests/cmd/seed/go.sum is excluded by !**/*.sum
📒 Files selected for processing (25)
  • .gitignore
  • Makefile
  • core/schemas/async.go
  • core/schemas/bifrost.go
  • examples/configs/withclickhouselogstore/config.json
  • examples/configs/withclickhouselogstorehttp/config.json
  • examples/plugins/hello-world/.gitignore
  • framework/docker-compose.yml
  • framework/go.mod
  • framework/logstore/clickhouse.go
  • framework/logstore/clickhousemigrate.go
  • framework/logstore/clickhousestore.go
  • framework/logstore/clickhousestore_test.go
  • framework/logstore/config.go
  • framework/logstore/dialectsql.go
  • framework/logstore/rdb.go
  • framework/logstore/store.go
  • scripts/bifrost-migration-cli/.gitignore
  • tests/cmd/e2eseed/go.mod
  • tests/cmd/seed/go.mod
  • tests/e2e/clis/.gitignore
  • tests/e2e/clis/reports/.keep
  • tests/semanticcache/.gitignore
  • transports/config.schema.json
  • ui/.gitignore
💤 Files with no reviewable changes (5)
  • examples/plugins/hello-world/.gitignore
  • scripts/bifrost-migration-cli/.gitignore
  • tests/semanticcache/.gitignore
  • tests/e2e/clis/.gitignore
  • ui/.gitignore
✅ Files skipped from review due to trivial changes (2)
  • tests/cmd/e2eseed/go.mod
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (16)
  • core/schemas/bifrost.go
  • examples/configs/withclickhouselogstorehttp/config.json
  • core/schemas/async.go
  • examples/configs/withclickhouselogstore/config.json
  • framework/docker-compose.yml
  • transports/config.schema.json
  • framework/logstore/dialectsql.go
  • framework/logstore/store.go
  • framework/logstore/config.go
  • framework/go.mod
  • Makefile
  • tests/cmd/seed/go.mod
  • framework/logstore/clickhousemigrate.go
  • framework/logstore/clickhousestore.go
  • framework/logstore/clickhouse.go
  • framework/logstore/rdb.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added ClickHouse as a supported log store, including configuration, schema validation, migrations, and example setups.
    • Expanded analytics and history queries to work with ClickHouse, including histograms and filtering.
  • Bug Fixes
    • Improved update behavior to preserve key record fields during edits and concurrent writes.
    • Added better handling for missing rows and empty batch operations.
  • Tests
    • Added ClickHouse unit and integration test coverage.
  • Chores
    • Updated dependencies and test runner setup for the new ClickHouse support.

Walkthrough

Adds ClickHouse as a supported log store with config/schema wiring, connection and migration setup, ClickHouse-backed writes, query-layer support, tests, and dependency updates.

Changes

ClickHouse LogStore Implementation

Layer / File(s) Summary
LogStore type and config wiring
framework/logstore/store.go, framework/logstore/config.go, transports/config.schema.json, examples/configs/withclickhouselogstore/*, examples/configs/withclickhouselogstorehttp/*, framework/docker-compose.yml, framework/go.mod, tests/cmd/e2eseed/go.mod, tests/cmd/seed/go.mod
Adds the ClickHouse log store type, config parsing and schema validation, example configs, compose service wiring, and dependency entries needed for ClickHouse support.
ClickHouse DSN and store construction
framework/logstore/clickhouse.go
Defines ClickHouse connection settings, DSN construction, and startup verification before migrations run.
ClickHouse table migration
framework/logstore/clickhousemigrate.go
Adds ClickHouse schema inference, table creation, column reconciliation, TTL helpers, and per-table migration steps.
ClickHouse writes and updates
framework/logstore/clickhousestore.go, core/schemas/async.go, core/schemas/bifrost.go
Implements ClickHouse insert, update, and bulk cost backfill paths with read-modify-write reinsertion and enum serialization support.
RDB query layer and histograms
framework/logstore/dialectsql.go, framework/logstore/rdb.go
Adds ClickHouse-specific filtering, aggregation, and histogram query support, plus shared unix bucket SQL generation.
Framework tests and repo ignores
framework/logstore/clickhousestore_test.go, Makefile, .gitignore, scripts/bifrost-migration-cli/.gitignore, tests/semanticcache/.gitignore
Adds ClickHouse unit and integration coverage, updates the framework test target, and changes repository ignore rules for generated outputs.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NewLogStore
  participant newClickHouseLogStore
  participant buildClickHouseDSN
  participant GORM
  participant triggerClickHouseMigrations

  NewLogStore->>newClickHouseLogStore: ClickHouseConfig + retentionDays
  newClickHouseLogStore->>buildClickHouseDSN: ClickHouseConfig
  buildClickHouseDSN-->>newClickHouseLogStore: DSN
  newClickHouseLogStore->>GORM: open connection
  newClickHouseLogStore->>GORM: SELECT 1
  newClickHouseLogStore->>triggerClickHouseMigrations: cluster + retentionDays
  triggerClickHouseMigrations-->>newClickHouseLogStore: migration result
  newClickHouseLogStore-->>NewLogStore: ClickHouseLogStore
Loading
sequenceDiagram
  participant Caller
  participant RDBLogStore
  participant unixBucketExpr
  participant ClickHouse

  Caller->>RDBLogStore: Get*Histogram request
  RDBLogStore->>unixBucketExpr: dialect + bucketSizeSeconds
  unixBucketExpr-->>RDBLogStore: bucket SQL
  RDBLogStore->>ClickHouse: aggregate query
  ClickHouse-->>RDBLogStore: bucketed rows and quantiles
  RDBLogStore-->>Caller: histogram result
Loading

Possibly related PRs

  • maximhq/bifrost#3210: Extends the same framework/logstore/rdb.go ClickHouse JSON filtering path around cache hit types.
  • maximhq/bifrost#4692: Touches Makefile test execution flow in the same test-framework target.
  • maximhq/bifrost#3567: Updates framework/logstore/rdb.go metadata distinct-key behavior in the same area.

Suggested reviewers: danpiths

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding ClickHouse support for the log store.
Description check ✅ Passed The description mostly matches the template and includes summary, changes, type, affected areas, testing, security, and checklist sections.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-28-clickhouse_support_for_log_store

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Jun 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@akshaydeo
akshaydeo marked this pull request as ready for review June 28, 2026 08:55

akshaydeo commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps

greptile-apps Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

This is close, but the config validation issue should be fixed before merging.

  • A normal ClickHouse log store config can still be rejected by the JSON schema.
  • The Go store path is present, but schema-validated deployments may not reach it.
  • The latest row update and timestamp-key fixes appear to address the previously reviewed in-process cases.

transports/config.schema.json

Important Files Changed

Filename Overview
transports/config.schema.json Adds ClickHouse to the log store schema, but the nested config discriminator can still reject normal ClickHouse configs.
framework/logstore/clickhousestore.go Adds ClickHouse insert and read-modify-write update behavior with local row-key locking.
framework/logstore/clickhousemigrate.go Adds ClickHouse table creation and column reconciliation for logs, MCP tool logs, and async jobs.

Comments Outside Diff (1)

  1. transports/config.schema.json, line 1268 (link)

    P1 Config still rejects ClickHouse

    This oneOf runs against the nested logs_store.config object, but each branch checks for a literal ../type property inside that object. A normal config only has type on the parent logs_store, so the branches do not select a single schema for ClickHouse. A config like the new examples with logs_store.type set to clickhouse and config.host set can still fail schema validation before the Go ClickHouse store is created. The discriminator needs to be modeled where type and config are both visible, or this branch needs a different shape that does not depend on a non-existent ../type property.

    Rule Used: transports/config.schema.json is the source of tru... (source)

Reviews (10): Last reviewed commit: "clickhouse support for log_store" | Re-trigger Greptile

Comment thread framework/logstore/config.go
Comment thread framework/logstore/clickhousestore.go
Comment thread framework/logstore/clickhousemigrate.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/logstore/clickhouse.go`:
- Around line 121-129: The ClickHouse store initialization path returns on ping
or migration failures without closing the underlying pool, so update the
constructor that runs db.WithContext(ctx).Exec("SELECT 1") and clickhouseMigrate
to defer closing the sql.DB until the store is fully created. Keep the close
deferred while validating the connection and running migrations, then cancel or
skip the close only after successful construction and transfer of ownership to
the returned store. Use the existing ClickHouse init flow and logger/error
return paths to ensure every startup failure releases the pool before returning.

In `@framework/logstore/clickhousemigrate.go`:
- Around line 86-100: The `ver` column in `clickhousemigrate.go` should use a
higher-resolution timestamp than `now64()` so rapid reinserts don’t share the
same version and defeat `ReplacingMergeTree(ver)` ordering. Update the table DDL
construction in the migration code that appends the `ver` column and builds the
`CREATE TABLE` statement to use a more precise default for `ver`, keeping the
existing `ReplacingMergeTree` and `ReplicatedReplacingMergeTree` setup intact.

In `@framework/logstore/clickhousestore.go`:
- Around line 41-71: The update helpers currently allow modifying ClickHouse
dedup key columns, which can turn an update into a new logical row. Update
chApplyUpdateMap and chApplyStructUpdate to skip or reject writes to the
immutable key fields used by logs/mcp_tool_logs, specifically the ORDER BY
columns timestamp and id, and ensure any attempt to set those fields returns an
error instead of applying the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ecee9426-00e3-4417-8111-4438c2e63331

📥 Commits

Reviewing files that changed from the base of the PR and between fe6ce5c and ce56f61.

⛔ Files ignored due to path filters (3)
  • framework/go.sum is excluded by !**/*.sum
  • tests/cmd/e2eseed/go.sum is excluded by !**/*.sum
  • tests/cmd/seed/go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • framework/go.mod
  • framework/logstore/clickhouse.go
  • framework/logstore/clickhousemigrate.go
  • framework/logstore/clickhousestore.go
  • framework/logstore/config.go
  • framework/logstore/dialectsql.go
  • framework/logstore/rdb.go
  • framework/logstore/store.go
  • tests/cmd/e2eseed/go.mod
  • tests/cmd/seed/go.mod

Comment thread framework/logstore/clickhouse.go
Comment thread framework/logstore/clickhousemigrate.go
Comment thread framework/logstore/clickhousestore.go
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch from ce56f61 to b0c3092 Compare June 28, 2026 18:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/logstore/clickhouse.go`:
- Around line 33-34: The ClickHouse config currently serializes DialTimeout as a
Go duration string, but logstore config duration fields must remain numeric
milliseconds. Update the ClickHouse config struct and any related
serialization/deserialization paths so dial_timeout is stored as milliseconds in
JSON, and only convert it to the ClickHouse driver’s duration string when
assembling the DSN in the ClickHouse connection builder. Use the existing
ClickHouse config symbols and DSN-building logic to keep the duration handling
consistent with the rest of framework/logstore.
- Around line 35-37: The Cluster field in clickhouse.go is interpolated into
ClickHouse DDL via the ON CLUSTER clause, so it must be validated or escaped
before use. Update the code path that builds the DDL to either reject invalid
cluster names up front or escape embedded backticks in config.Cluster before
passing it into the fmt.Sprintf/ON CLUSTER logic. Make sure the fix is applied
in the Cluster-related DDL construction around the ClickHouse logstore config
handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 77faf937-57ce-4e13-b0f7-00d169555ae1

📥 Commits

Reviewing files that changed from the base of the PR and between ce56f61 and b0c3092.

⛔ Files ignored due to path filters (3)
  • framework/go.sum is excluded by !**/*.sum
  • tests/cmd/e2eseed/go.sum is excluded by !**/*.sum
  • tests/cmd/seed/go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • framework/go.mod
  • framework/logstore/clickhouse.go
  • framework/logstore/clickhousemigrate.go
  • framework/logstore/clickhousestore.go
  • framework/logstore/config.go
  • framework/logstore/dialectsql.go
  • framework/logstore/rdb.go
  • framework/logstore/store.go
  • tests/cmd/e2eseed/go.mod
  • tests/cmd/seed/go.mod
🚧 Files skipped from review as they are similar to previous changes (8)
  • framework/logstore/config.go
  • framework/logstore/dialectsql.go
  • framework/logstore/store.go
  • tests/cmd/e2eseed/go.mod
  • framework/logstore/clickhousemigrate.go
  • framework/go.mod
  • tests/cmd/seed/go.mod
  • framework/logstore/clickhousestore.go

Comment thread framework/logstore/clickhouse.go Outdated
Comment thread framework/logstore/clickhouse.go
@akshaydeo
akshaydeo requested a review from a team as a code owner June 30, 2026 03:04
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch from b0c3092 to 5d01e28 Compare July 3, 2026 10:48
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 3, 2026
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch 3 times, most recently from ab5653d to 8e6c4b1 Compare July 3, 2026 12:00
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 3, 2026
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch 2 times, most recently from 82dbb2c to 0fbae96 Compare July 3, 2026 12:45
Comment thread framework/logstore/clickhousemigrate.go
@akshaydeo akshaydeo mentioned this pull request Jul 3, 2026
8 tasks
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 3, 2026
@danpiths
danpiths force-pushed the 06-28-clickhouse_support_for_log_store branch from 0fbae96 to 50f6d12 Compare July 5, 2026 14:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
framework/logstore/clickhousestore_test.go (1)

568-599: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Histogram tests only check non-nil, not actual bucket values.

All four assertions (GetHistogram, GetCostHistogram, GetTokenHistogram, GetModelRankings) only verify the result isn't nil. Since 4 entries are seeded with identical, known cost/token values, these tests would still pass even if the ClickHouse-specific bucket/quantile SQL (dialectsql.go) miscounted or mis-bucketed data.

♻️ Example of stronger assertions
 	hist, err := store.GetHistogram(ctx, SearchFilters{}, 60)
 	require.NoError(t, err)
 	require.NotNil(t, hist)
+	// e.g. assert total count across buckets equals 4, or that a specific bucket has count 4.

 	costHist, err := store.GetCostHistogram(ctx, SearchFilters{}, 60)
 	require.NoError(t, err)
 	require.NotNil(t, costHist)
+	// e.g. assert aggregated cost across buckets equals 4 * 0.25.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/logstore/clickhousestore_test.go` around lines 568 - 599, The
histogram test in TestClickHouseHistograms only checks that results from
GetHistogram, GetCostHistogram, GetTokenHistogram, and GetModelRankings are
non-nil, so it would miss broken bucket/quantile aggregation. Strengthen the
assertions by verifying the actual returned bucket counts and values against the
four seeded log entries with known Status, Cost, TotalTokens, PromptTokens, and
CompletionTokens, using the same SearchFilters and helper methods to confirm the
ClickHouse SQL in dialectsql.go is producing the expected histogram and ranking
data.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/configs/withclickhouselogstorehttp/config.json`:
- Around line 27-29: The example provider key value in the config entry is too
похожe to a real OpenAI secret and should be replaced with an obviously dummy
placeholder or environment-based reference. Update the value used in the example
config item identified by the name field "openai-key-1" so it is clearly
non-secret and not copyable as a real credential, while keeping the example
structure intact.

In `@framework/logstore/clickhousemigrate.go`:
- Around line 175-184: `clickhouseReconcileColumns` is adding missing columns
without honoring the same override logic used by `clickhouseCreateTable`, so
reconciled tables can lose special defaults like `inc_number`’s Snowflake
generator. Update the column-add path in `clickhouseReconcileColumns` to apply
`chColumnOverrides` before generating the ClickHouse type, matching the behavior
already used during table creation. Keep the existing migration flow and ensure
the override is applied whenever a missing column is added.

---

Nitpick comments:
In `@framework/logstore/clickhousestore_test.go`:
- Around line 568-599: The histogram test in TestClickHouseHistograms only
checks that results from GetHistogram, GetCostHistogram, GetTokenHistogram, and
GetModelRankings are non-nil, so it would miss broken bucket/quantile
aggregation. Strengthen the assertions by verifying the actual returned bucket
counts and values against the four seeded log entries with known Status, Cost,
TotalTokens, PromptTokens, and CompletionTokens, using the same SearchFilters
and helper methods to confirm the ClickHouse SQL in dialectsql.go is producing
the expected histogram and ranking data.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e7f21bcf-bc24-4071-b400-08542f9d5ce1

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6c4b1 and 50f6d12.

⛔ Files ignored due to path filters (3)
  • framework/go.sum is excluded by !**/*.sum
  • tests/cmd/e2eseed/go.sum is excluded by !**/*.sum
  • tests/cmd/seed/go.sum is excluded by !**/*.sum
📒 Files selected for processing (25)
  • .gitignore
  • Makefile
  • core/schemas/async.go
  • core/schemas/bifrost.go
  • examples/configs/withclickhouselogstore/config.json
  • examples/configs/withclickhouselogstorehttp/config.json
  • examples/plugins/hello-world/.gitignore
  • framework/docker-compose.yml
  • framework/go.mod
  • framework/logstore/clickhouse.go
  • framework/logstore/clickhousemigrate.go
  • framework/logstore/clickhousestore.go
  • framework/logstore/clickhousestore_test.go
  • framework/logstore/config.go
  • framework/logstore/dialectsql.go
  • framework/logstore/rdb.go
  • framework/logstore/store.go
  • scripts/bifrost-migration-cli/.gitignore
  • tests/cmd/e2eseed/go.mod
  • tests/cmd/seed/go.mod
  • tests/e2e/clis/.gitignore
  • tests/e2e/clis/reports/.keep
  • tests/semanticcache/.gitignore
  • transports/config.schema.json
  • ui/.gitignore
💤 Files with no reviewable changes (6)
  • tests/semanticcache/.gitignore
  • ui/.gitignore
  • examples/plugins/hello-world/.gitignore
  • scripts/bifrost-migration-cli/.gitignore
  • tests/e2e/clis/.gitignore
  • transports/config.schema.json
✅ Files skipped from review due to trivial changes (2)
  • examples/configs/withclickhouselogstore/config.json
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (10)
  • framework/logstore/dialectsql.go
  • core/schemas/bifrost.go
  • framework/logstore/config.go
  • framework/logstore/store.go
  • core/schemas/async.go
  • tests/cmd/seed/go.mod
  • Makefile
  • framework/go.mod
  • tests/cmd/e2eseed/go.mod
  • framework/logstore/rdb.go

Comment thread examples/configs/withclickhouselogstorehttp/config.json
Comment thread framework/logstore/clickhousemigrate.go
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch from 3dbfd57 to 4e85377 Compare July 5, 2026 21:54
@akshaydeo
akshaydeo force-pushed the 06-28-clickhouse_support_for_log_store branch from 4e85377 to 599ad8a Compare July 5, 2026 22:24

akshaydeo commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jul 5, 10:45 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 5, 10:45 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 416cdc0 into dev Jul 5, 2026
10 of 17 checks passed
@akshaydeo
akshaydeo deleted the 06-28-clickhouse_support_for_log_store branch July 5, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants