Skip to content

feat(dashboard-api): LD-gated ClickHouse read switcher#3111

Merged
rguliyev merged 2 commits into
mainfrom
dashboard-api-clickhouse-switcher
Jun 26, 2026
Merged

feat(dashboard-api): LD-gated ClickHouse read switcher#3111
rguliyev merged 2 commits into
mainfrom
dashboard-api-clickhouse-switcher

Conversation

@rguliyev

Copy link
Copy Markdown
Contributor

What

Migrate dashboard-api to the LD-gated ClickHouse switching client, mirroring the api service (introduced in #3061). Replaces the single fixed-DSN client with clickhouse.NewSwitchingClient, gated on the clickhouse-read-endpoint flag, so dashboard-api reads can shift to the Aiven alternate in lock-step with api.

Why

dashboard-api was the only ClickHouse reader still hardwired to the single (legacy) DSN with no flag awareness — it would not follow the clickhouse-read-endpoint cutover. This brings it in line with api, data-exporter, argus-api, bot-detection, etc.

Changes

  • internal/cfg/model.go: add ClickhouseConnectionStrings (alternates, ;-separated) and DomainName.
  • main.go: build a feature-flags client, SetServiceName + SetDeploymentName(config.DomainName) (same deployment context as api, so both resolve to the same endpoint), and construct NewSwitchingClient(..., WithAllowNoopDefault(true)). The noop-default preserves the prior empty-DSN behavior.

Notes

  • Requires the matching Terraform change to set CLICKHOUSE_CONNECTION_STRINGS + DOMAIN_NAME on the dashboard-api job (separate PR in the terraform repo).
  • go build / go vet / gofmt clean.

Mirror the api service: replace the single fixed-DSN ClickHouse client
with NewSwitchingClient gated on the clickhouse-read-endpoint flag, so
dashboard-api reads can shift to the Aiven alternate alongside api.

Add ClickhouseConnectionStrings (alternates) and DomainName to config;
SetDeploymentName(config.DomainName) so flag evaluation uses the same
deployment context as api and both resolve to the same endpoint.
WithAllowNoopDefault(true) preserves the prior empty-DSN noop behavior.
@rguliyev rguliyev requested a review from ben-fornefeld as a code owner June 26, 2026 21:45
@cla-bot cla-bot Bot added the cla-signed label Jun 26, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the dashboard API configuration to support multiple ClickHouse connection strings and a domain name, and integrates a feature flags client to enable dynamic ClickHouse endpoint switching via a new switching client. There are no review comments, and we have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

❌ 7 Tests Failed:

Tests completed Failed Passed Skipped
3086 7 3079 8
View the top 3 failed test(s) by shortest run time
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestListDir/depth_0_lists_only_root_directory
Stack Traces | 0.01s run time
=== RUN   TestListDir/depth_0_lists_only_root_directory
=== PAUSE TestListDir/depth_0_lists_only_root_directory
=== CONT  TestListDir/depth_0_lists_only_root_directory
    filesystem_test.go:96: 
        	Error Trace:	.../tests/envd/filesystem_test.go:96
        	Error:      	Received unexpected error:
        	            	unavailable: 502 Bad Gateway
        	Test:       	TestListDir/depth_0_lists_only_root_directory
--- FAIL: TestListDir/depth_0_lists_only_root_directory (0.01s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestListDir/depth_1_lists_root_directory
Stack Traces | 0.01s run time
=== RUN   TestListDir/depth_1_lists_root_directory
=== PAUSE TestListDir/depth_1_lists_root_directory
=== CONT  TestListDir/depth_1_lists_root_directory
    filesystem_test.go:96: 
        	Error Trace:	.../tests/envd/filesystem_test.go:96
        	Error:      	Received unexpected error:
        	            	unavailable: 502 Bad Gateway
        	Test:       	TestListDir/depth_1_lists_root_directory
--- FAIL: TestListDir/depth_1_lists_root_directory (0.01s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory)
Stack Traces | 0.01s run time
=== RUN   TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory)
=== PAUSE TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory)
=== CONT  TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory)
    filesystem_test.go:96: 
        	Error Trace:	.../tests/envd/filesystem_test.go:96
        	Error:      	Received unexpected error:
        	            	unavailable: 502 Bad Gateway
        	Test:       	TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory)
--- FAIL: TestListDir/depth_2_lists_first_level_of_subdirectories_(in_this_case_the_root_directory) (0.01s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestListDir/depth_3_lists_all_directories_and_files
Stack Traces | 0.01s run time
=== RUN   TestListDir/depth_3_lists_all_directories_and_files
=== PAUSE TestListDir/depth_3_lists_all_directories_and_files
=== CONT  TestListDir/depth_3_lists_all_directories_and_files
    filesystem_test.go:96: 
        	Error Trace:	.../tests/envd/filesystem_test.go:96
        	Error:      	Received unexpected error:
        	            	unavailable: 502 Bad Gateway
        	Test:       	TestListDir/depth_3_lists_all_directories_and_files
--- FAIL: TestListDir/depth_3_lists_all_directories_and_files (0.01s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestListDir
Stack Traces | 0.52s run time
=== RUN   TestListDir
=== PAUSE TestListDir
=== CONT  TestListDir
--- FAIL: TestListDir (0.52s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestSandboxCreateWithTag
Stack Traces | 150s run time
=== RUN   TestSandboxCreateWithTag
=== PAUSE TestSandboxCreateWithTag
=== CONT  TestSandboxCreateWithTag
    template_tags_test.go:115: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestSandboxCreateWithTag (150.41s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestSandboxCreateWithAliasAndTag
Stack Traces | 156s run time
=== RUN   TestSandboxCreateWithAliasAndTag
=== PAUSE TestSandboxCreateWithAliasAndTag
=== CONT  TestSandboxCreateWithAliasAndTag
    template_tags_test.go:207: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestSandboxCreateWithAliasAndTag (155.62s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@rguliyev rguliyev enabled auto-merge (squash) June 26, 2026 21:51
@rguliyev rguliyev disabled auto-merge June 26, 2026 21:59
@rguliyev rguliyev enabled auto-merge (squash) June 26, 2026 21:59
@rguliyev rguliyev merged commit 64b5356 into main Jun 26, 2026
52 checks passed
@rguliyev rguliyev deleted the dashboard-api-clickhouse-switcher branch June 26, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants