Skip to main content

Connecting to ClickHouse

TraceHouse connects to ClickHouse over HTTP(S) and requires read access to the system tables used for monitoring.

Supported Environments​

EnvironmentCORSProxy neededNotes
ClickHouse CloudBuilt-inNoDirect browser access supported
Self-managed (on-prem / VM)Needs configUsually yesEnable CORS in ClickHouse config, or use the bundled proxy
Kubernetes (Altinity Operator, ClickHouse Operator)Needs configUsually yesSame as self-managed; ensure the HTTP interface is exposed
Aiven for ClickHouseNo CORSYesUse the bundled proxy and configure credentials in .env
Docker Compose / Kind (this repo)Pre-configuredNoFor 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.

Docker networking

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.events
  • system.processes, system.merges, system.mutations
  • system.query_log, system.part_log
  • system.parts, system.columns, system.tables
  • system.clusters, system.replicas, system.disks
  • system.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.

TableWhat it lists for every account and object
system.tablesTable definitions, including view queries and engine arguments such as storage URLs. Embedded credentials are masked as [HIDDEN] by default.
system.usersUser names, authentication type, host restrictions, expiry and default roles. Passwords and password hashes are not included.
system.rolesRole names
system.role_grantsWhich users and roles hold which roles
system.grantsEvery privilege of every user and role, down to columns
system.row_policiesRow filter expressions, including the values they compare against, and who they apply to
system.privilegesClickHouse'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.

PrivilegeWhat it shows
SHOW ROLESSHOW 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 POLICIESSHOW CREATE ROW POLICY. The data is the same as in system.row_policies.
SHOW USERSSHOW 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_ns from system.settings
  • Cluster topology - queries system.clusters, falls back to system.replicas if inaccessible
  • ZooKeeper / Keeper - checks if system.zookeeper is present
  • Access definitions - checks SELECT on system.users, system.roles, system.role_grants, system.grants and system.row_policies. The object browser skips the ones without it and names the missing grant.
  • Access statements - checks the SHOW USERS, SHOW ROLES and SHOW ROW POLICIES privileges that object details need
  • ClickHouse Cloud - detects cloud via cloud_mode_engine setting and system.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 CloudSelf-ManagedAivenKubernetes
CORSBuilt-inNeeds configNo CORS - use proxyNeeds config
Proxy neededNoUsually yesYesUsually yes
System log tablesAll availableAll availableMany restricted (details)All available
Log TTLConfigurableConfigurable1 hour (hard limit)Configurable
allow_introspection_functionsOff by default - must enableOff by defaultNot availableOff by default - must enable
Query profilerAvailableNeeds configNot availableNeeds config
FlamegraphsRequires introspection functionsRequires introspection functions + profilerNot supported (no trace_log)Requires introspection functions + profiler
Aiven

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.

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>
note

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.