Skip to contentSkip to page list

Docs

Dashboards on your own ClickHouse (hybrid install)

Set up the read-only ClickHouse user that dashboards use in a hybrid install, and check that it only sees your projects

On this page

In a hybrid setup, LangWatch runs the control plane and your data stays in the data plane: your own ClickHouse, reached over a private link. Dashboards query that ClickHouse as a read-only user that can only see your projects' rows. This page sets that user up and shows how to check that it works.

Before you start

  • ClickHouse 26.8 or later. See External ClickHouse.
  • Query masking rules on every server, so the tenant key never lands in the server log, system.text_log or system.query_log. Use the rules in the LangWatchQL note of the Kubernetes guide.
  • More than one host? The LangWatch database must use the Replicated database engine.
Warning

Step 4, the key map, is not available yet for a ClickHouse you run yourself. Contact LangWatch at [email protected] before you start.

Steps

1. LangWatch creates the reader password

LangWatch sets a password of at least 32 characters, for your organisation only, and keeps it. You never handle the password.

Check: LangWatch confirms the password is in place for your organisation.

2. LangWatch gives you the reader file

LangWatch renders one ClickHouse users file for your organisation. You do not write it. Ask LangWatch for it when you contact support before you start. It defines the reader's settings profile, grants and row policy. The file carries only the password's sha256 hash, never the password.

The reader's name is langwatch_lwql_ followed by the first 12 hex characters of the sha256 of your organisation id.

Check: the file names that user, and holds the hash, not the password.

3. Mount the file on every replica

Put the file in ClickHouse's users.d directory on each replica, then reload the configuration. Do not also define this user anywhere else, such as your own users.d files or SQL. If the reader is stored in SQL, LangWatch stops provisioning. LangWatch does not detect a second definition in another file, so remove any duplicate file definition yourself.

Check: run this on each replica, one at a time. It must return the user on every one.

example.sqlSQL
SELECT name FROM system.users WHERE name LIKE 'langwatch_lwql_%';

A replica without the file fails LangWatch's check whenever the load balancer picks it.

4. Key map

Warning

This step is not available yet for a ClickHouse you run yourself. Contact LangWatch at [email protected].

The key map, lwql_project_keys, says which projects a caller's key may read. The reader's row policy filters every table through it, so without it the reader sees no rows. When the key map table exists but holds no rows for your projects, dashboards show empty results and do not refuse. A missing key map table can make the probe fail and refuse dashboards with lwql_not_provisioned.

5. Provisioning runs by itself

After each LangWatch upgrade, LangWatch connects to your ClickHouse with the admin login it holds for the private link and creates the views and tables in your LangWatch database. No action is needed on your side.

Check: the views exist:

example.sqlSQL
SHOW TABLES FROM <database>;

6. Open a dashboard

Before the first dashboard loads, LangWatch runs one probe as the reader, with an empty tenant key:

example.sqlSQL
SELECT 1 AS visible FROM traces LIMIT 1

The reader must log in, see traces, carry the tenant setting, and get zero rows back. LangWatch remembers the answer for 5 minutes.

Check: the dashboard shows data, not an error.

Prove it

On your ClickHouse, run this on each replica, or across all of them with clusterAllReplicas('<cluster>', system.query_log):

example.sqlSQL
SELECT event_time, user, exception_code, log_comment, substring(query, 1, 80) AS queryFROM system.query_logWHERE user LIKE 'langwatch_lwql_%'  AND type != 'QueryStart'ORDER BY event_time DESCLIMIT 20;

Good: rows for your reader user, exception_code 0, and a log_comment of the form lwql:project=<id>. The probe's row has an empty project list (lwql:project=).

If it fails

CodeMeaningDo
lwql_not_provisioned (403)A check failed: the login, the traces grant, the tenant setting, or the probe returned rows. Usually the reader file is missing on a replica.Re-check step 3 on every replica. LangWatch remembers the answer for 5 minutes, so wait before you retry.
lwql_unavailable (503)LangWatch has no route to your ClickHouse for your organisation, or cannot decide.Contact LangWatch. This is not a ClickHouse setup problem.
projects_required (422)An organisation, team or personal key ran a query without naming projects.Name the projects. This is not a setup problem.
query_memory_exceeded (422)ClickHouse error 241: the query ran out of memory.Narrow the dashboard with a shorter time range or a filter. Adding replica memory does not raise the reader's memory cap, which LangWatch sets. To change the cap, contact LangWatch.
lwql_not_permitted (400)LangWatch's own query check refused the query: it names a table or column the caller may not see.Change the query. This is not a ClickHouse problem.

Only the LangWatch reader is isolated by tenant. Any other ClickHouse user you grant the LangWatch database reads every tenant's rows. To give people and tools their own logins, see ClickHouse access.

Documentation