Connecting to ClickHouse
TraceHouse connects to ClickHouse over HTTP(S) and requires read access to the system tables used for monitoring.
Supported Environments
| Environment | CORS | Proxy needed | Notes |
|---|---|---|---|
| ClickHouse Cloud | Built-in | No | Direct browser access supported |
| Self-managed (on-prem / VM) | Needs config | Usually yes | Enable CORS in ClickHouse config, or use the bundled proxy |
| Kubernetes (Altinity Operator, ClickHouse Operator) | Needs config | Usually yes | Same as self-managed; ensure the HTTP interface is exposed |
| Aiven for ClickHouse | No CORS | Yes | Use the bundled proxy and configure credentials in .env |
| Docker Compose / Kind (this repo) | Pre-configured | No | For local development and testing |
Connection Setup
The primary way to connect is through the app's connection UI - enter your host, port, and credentials directly in the browser. The app defaults to HTTPS (port 8443) for remote hosts and HTTP (port 8123) for localhost.
.env file (for scripts only)
The .env file configures connection details for CLI scripts (just generate-data, just run-queries, etc.) - it is not used by the frontend app itself. See Loading Test Data - Configuration for details.
CORS Proxy
When connecting to a ClickHouse instance that doesn't return CORS headers (common with self-managed and Aiven), the browser will block requests. The app routes these through a lightweight proxy that forwards them server-side. See Deployment for the different ways to run TraceHouse with the proxy included.
Docker image - the proxy is bundled and always active. Enter the ClickHouse host in the connection form; requests are routed through the bundled proxy.
Development / standalone - the proxy starts automatically with just frontend-start on localhost:8990. To run it separately:
just proxy-start
Then enable "Use CORS proxy" in the connection form and point it at http://localhost:8990/proxy.
The proxy is a small Express server (packages/proxy/) that forwards requests to ClickHouse server-side and streams responses back with permissive CORS headers. It's completely stateless - connection details are passed in request headers on every call.
When running the Docker image and connecting to ClickHouse on your host machine, use host.docker.internal instead of localhost as the host. Inside Docker, localhost refers to the container itself.
Cluster Topology
TraceHouse automatically detects cluster topology by querying system.clusters. For multi-shard or multi-replica setups, the app uses a host-targeted adapter to query individual nodes.
Required Permissions
The monitoring user needs read access to system tables:
GRANT SELECT ON system.* TO monitoring_user;
For full functionality, the following system tables are queried:
system.metrics,system.asynchronous_metrics,system.eventssystem.processes,system.merges,system.mutationssystem.query_log,system.part_logsystem.parts,system.columns,system.tablessystem.clusters,system.replicas,system.diskssystem.dictionaries,system.replication_queue
Grants are only one of the two requirements. A feature the connecting user has access to can still be unavailable if the server is older than the version that feature needs. See ClickHouse Compatibility for the minimum version of each gated feature.
Object browser
For navigation, diagram controls, and interpreting configured access answers, see Object browser.
The object browser reads access and table definitions. Without the access tables it still shows tables and the links between them.
| Table | What it lists for every account and object |
|---|---|
system.tables | Table definitions, including view queries and engine arguments such as storage URLs. Embedded credentials are masked as [HIDDEN] by default. |
system.users | User names, authentication type, host restrictions, expiry and default roles. Passwords and password hashes are not included. |
system.roles | Role names |
system.role_grants | Which users and roles hold which roles |
system.grants | Every privilege of every user and role, down to columns |
system.row_policies | Row filter expressions, including the values they compare against, and who they apply to |
system.privileges | ClickHouse's privilege list. Every user can read it. |
Object details show the server's own CREATE statement and grants. These statements need privileges of their own. Without them the catalog still loads and only the statement is unavailable.
| Privilege | What it shows |
|---|---|
SHOW ROLES | SHOW CREATE ROLE and SHOW GRANTS FOR a role. The data is the same as in system.roles and system.grants, plus any settings defined on the role. |
SHOW ROW POLICIES | SHOW CREATE ROW POLICY. The data is the same as in system.row_policies. |
SHOW USERS | SHOW CREATE USER and SHOW GRANTS FOR a user. Besides what system.users lists, the output includes the settings defined on the user, which are otherwise only in system.settings_profile_elements. |
Grant them with GRANT SHOW ROLES, SHOW ROW POLICIES ON *.* TO <user>. Grant SHOW USERS only to accounts that may read every user's settings. The TraceHouse demo's read_only account has SHOW ROLES and SHOW ROW POLICIES but not SHOW USERS.
Secrets and passwords: None of these SELECT grants expose user passwords or password hashes. In system.tables and SHOW CREATE output, ClickHouse masks embedded credentials (such as storage keys or external database passwords) as [HIDDEN] unless all three of the following are enabled: the server setting display_secrets_in_show_and_select = 1, the session setting format_display_secrets_in_show_and_select = 1, and the displaySecretsInShowAndSelect privilege. Do not grant displaySecretsInShowAndSelect to a monitoring or read-only account; TraceHouse never requests it and explicitly sets format_display_secrets_in_show_and_select = 0 when running SHOW CREATE USER.
Metadata sensitivity: The access tables describe every account on the server, not only the connected one. They do not leak passwords, but they do expose account and role inventory, authentication types (including whether any account uses no_password), host allowlists, full privilege maps, and literal row-policy filter expressions (which in multi-tenant setups may contain tenant identifiers). Grant them only to accounts that may see that. A shared or public read-only account usually should not have them. The TraceHouse demo's read_only account has them.
To find links that system.tables does not store directly, the object browser runs EXPLAIN AST and EXPLAIN QUERY TREE on view queries and engine definitions. These need no grant beyond SELECT on system.tables. A view whose query uses a table function or a scalar subquery is not analyzed when the catalog loads, because analysis could contact the source or run the subquery. Its details offer the analysis on request.
Imported dashboards and custom SQL
Dashboards may contain SQL that runs automatically when opened. Dashboard queries and SQL entered in the Query Explorer run with your ClickHouse connection's permissions. TraceHouse does not restrict them to read-only statements.
Only import dashboards from sources you trust. When an import contains embedded SQL, the dialog lists it and requires your confirmation before importing. Review that SQL before proceeding. If no embedded SQL is detected, the dialog says so; panels may still run existing queries referenced by the dashboard.
Use a dedicated read-only ClickHouse account with access limited to the data you need. Import confirmation does not change the connection's permissions.
Automatic capability detection
On connect, the app probes the server to determine what is available and degrades gracefully when features are missing. The detection covers:
- Server version - via
version() - System log tables - checks which log tables exist in
system.tables(e.g.query_log,trace_log,part_log,metric_log) - Introspection functions - tests
demangle('')to see if flamegraphs and stack trace demangling will work - CPU profiler - reads
query_profiler_cpu_time_period_ns/query_profiler_real_time_period_nsfromsystem.settings - Cluster topology - queries
system.clusters, falls back tosystem.replicasif inaccessible - ZooKeeper / Keeper - checks if
system.zookeeperis present - Access definitions - checks
SELECTonsystem.users,system.roles,system.role_grants,system.grantsandsystem.row_policies. The object browser skips the ones without it and names the missing grant. - Access statements - checks the
SHOW USERS,SHOW ROLESandSHOW ROW POLICIESprivileges that object details need - ClickHouse Cloud - detects cloud via
cloud_mode_enginesetting andsystem.build_options - Container environment - reads cgroup CPU/memory limits, detects Kubernetes by hostname pattern
Screens that depend on a missing capability are either hidden or show a message explaining what is needed. See packages/core/src/services/monitoring-capabilities.ts for the full probe logic.
Environment-Specific Notes
| ClickHouse Cloud | Self-Managed | Aiven | Kubernetes | |
|---|---|---|---|---|
| CORS | Built-in | Needs config | No CORS - use proxy | Needs config |
| Proxy needed | No | Usually yes | Yes | Usually yes |
| System log tables | All available | All available | Many restricted (details) | All available |
| Log TTL | Configurable | Configurable | 1 hour (hard limit) | Configurable |
allow_introspection_functions | Off by default - must enable | Off by default | Not available | Off by default - must enable |
| Query profiler | Available | Needs config | Not available | Needs config |
| Flamegraphs | Requires introspection functions | Requires introspection functions + profiler | Not supported (no trace_log) | Requires introspection functions + profiler |
Aiven has significant system table restrictions that affect several features. Aiven also enforces a short TTL (typically 1 hour) on most system log tables - their recommended workaround is to create materialized views that copy log data into regular tables for longer retention. We are planning to support configurable system table locations so the app can read from those materialized views instead. See the dedicated Aiven for ClickHouse guide for full details on limitations and workarounds.
Recommended Settings
allow_introspection_functions
This setting enables functions like demangle, addressToLine, and addressToSymbol which are required for flamegraph visualization and stack trace demangling. ClickHouse Cloud disables this by default.
There are three ways to enable it:
Per session (current session only):
SET allow_introspection_functions = 1;
Per user (persistent):
ALTER USER my_user SETTINGS allow_introspection_functions = 1;
Per role (persistent, applies to all users with the role):
ALTER ROLE my_role SETTINGS allow_introspection_functions = 1;
Via config file (self-managed only - add to user profile in users.xml or users.d/):
<profiles>
<default>
<allow_introspection_functions>1</allow_introspection_functions>
</default>
</profiles>
The config file change requires SYSTEM RELOAD CONFIG or a server restart to take effect. The SET approach only applies to the current session. For a monitoring user that needs this permanently, prefer ALTER USER or ALTER ROLE.
Query Profiler
For flamegraphs to collect data, the query profiler must be active. On self-managed and Kubernetes deployments, ensure these settings are configured:
<profiles>
<default>
<query_profiler_cpu_time_period_ns>40000000</query_profiler_cpu_time_period_ns>
<query_profiler_real_time_period_ns>40000000</query_profiler_real_time_period_ns>
</default>
</profiles>
On ClickHouse Cloud, the query profiler is already active - you only need to enable allow_introspection_functions.