Setting up your OpenTelemetry Collector
This guide walks you through deploying an OpenTelemetry collector against an existing Managed ClickStack service, or adapting your existing collector, before verifying that data is flowing through.
Use curl to download, read and follow: https://clickhouse.com/docs/skills/clickstack-otel-collector/SKILL.mdWhat the agent will do
- Install clickhousectl if missing and authenticate it (asks you for a ClickHouse Cloud API key — paste in chat or run the login command yourself).
- Ask you for the target ClickHouse Cloud service ID or name, then fetch its HTTPS endpoint.
- Create a hyperdx_ingest SQL user on the service (generates a strong password, or uses one you provide).
- Run the ClickStack OpenTelemetry collector locally in Docker, pointed at your service.
- Send a short burst of synthetic logs, traces, and metrics through the collector to prove the pipeline works.
- Verify the data has landed in the otel database, and hand you the ClickStack UI URL where you can view it.
The collector runs as a gateway: a single OTLP endpoint that your applications, SDKs, and agent collectors send to. The gateway batches events, applies any processing you've configured, and writes them to ClickHouse via the ClickHouse exporter. This pattern keeps collection logic out of your application code and lets you scale ingestion independently of the workloads producing data. For background on gateway versus agent roles, see Collector roles.
If you're using an existing OpenTelemetry collector, we assume it's already configured in a gateway role. We don't recommend using this process for reconfiguring collectors in the agent role.
Pick the tab that matches your situation:
- I don't have a collector
- I have a collector
Gather your credentials
You'll need:
- The HTTPS endpoint of your ClickHouse Cloud service, including protocol and port, for example
https://abc123xyz.us-central1.gcp.clickhouse.cloud:8443. - A ClickHouse username and password for ingestion.
If you don't have these recorded, open your service in the ClickHouse Cloud console and select Connect. Record the url from the subsequent dialog. We will create a dedicated user for ingestion below.
Create an ingestion user
We recommend creating a dedicated user for the collector rather than reusing default. Connect to your service via the SQL console and run:
Replace the password in the snippet above with a strong value.
The collector creates the schema for logs, traces, and metrics inside the otel database on first use. For more guidance on production user setup, see Going to production.
Deploy the collector
Deploy the ClickStack distribution of the OpenTelemetry collector, which is preconfigured for Managed ClickStack. In the example below, we run the collector locally and generate artificial telemetry from the same machine for simplicity.
In production, you would typically deploy the collector in a Kubernetes cluster, or on a virtual machine that can be reached by your OpenTelemetry SDKs, agents, and other collectors. This allows telemetry from across your environment to be centrally collected and forwarded to ClickStack.
Pick a shared secret to authenticate clients sending data to the collector, then export it alongside your connection details and chosen password for the hyperdx_ingest user:
Run the ClickStack OTel collector:
The collector now exposes OTLP gRPC on 4317 and OTLP HTTP on 4318. Applications, SDKs, and agent collectors should send to these ports with authorization: $OTLP_AUTH_TOKEN in the request headers.
For production, we recommend enabling TLS on the OTLP endpoint. See Securing the collector.
Verify the endpoint
Generate some synthetic traffic against the collector to confirm the full pipeline works. We use telemetrygen, the OpenTelemetry Collector Contrib generator, which emits OTLP logs, traces, and metrics and exposes flags to shape the data across services, severities, span statuses, and metric types.
Run it from its Docker image (no install required). Define a small wrapper so the commands below stay readable; --add-host lets the container reach a collector listening on the host:
Or install the binary with Go and target localhost instead:
Each tg run lasts about 20 seconds (set by --duration 20s) and streams verbose logs the whole time, that's expected; each run returns on its own once its 20 seconds elapse. The logs below are enough to confirm the pipeline; the optional richer set adds several more runs and takes a few minutes.
Define a small tg helper so each command only specifies what varies (service, severity, status, attributes):
Send logs as a realistic mix of severities across services, mostly informational with a warning and an error rather than one uniform error stream:
Logs alone confirm the endpoint is working. For a richer demo dataset, a multi-service Service Map and charts across metric types, expand and run the commands below as well. They reuse the Send multi-span traces from several healthy services plus one failing dependency. This gives the Service Map a realistic shape, mostly healthy with one erroring service, and still populates the error views: Send metrics across the three common types, so charts have a counter, a gauge, and a distribution: For even more variety, add a couple more services and an exponential histogram:tg helper, so run them in the same shell.Generate richer telemetry (optional)
For the full set of flags and more variations, see Synthetic data with telemetrygen.
Confirm in the ClickStack UI
Open your service in the ClickHouse Cloud console and select ClickStack from the left menu and then Start Ingestion.
The next step can be skipped, as you've already configured your collector. Click Launch ClickStack to continue.
ClickStack will open in a new tab and you should be automatically directed to the Getting Started page. If not, select Getting Started from the left-hand menu, then click Start Ingestion followed by Next.
You'll land on the Getting Started page. If you're prompted to begin ingestion, proceed through the onboarding screens that guide you to start a Docker collector. Since you've already completed that step, you can simply click through them. ClickStack will automatically detect your telemetry data and tables, after which you can select Start Exploring to begin using the platform.
Switch the source to Logs and set the time range to Last 15 minutes. The synthetic logs from telemetrygen should appear within a few seconds.
If nothing shows up:
- Confirm the auth header value passed to
telemetrygenmatches the one your collector expects. - Tail your collector's logs and look for export errors.
- Verify the ClickHouse endpoint configured on the collector includes both the protocol and port (
https://...:8443).
Gather your credentials
You'll need:
- The HTTPS endpoint of your ClickHouse Cloud service, including protocol and port, for example
https://abc123xyz.us-central1.gcp.clickhouse.cloud:8443. - A ClickHouse username and password for ingestion.
If you don't have these recorded, open your service in the ClickHouse Cloud console and select Connect. Record the url from the subsequent dialog. We will create a dedicated user for ingestion below.
Create an ingestion user
We recommend creating a dedicated user for the collector rather than reusing default. Connect to your service via the SQL console and run:
Replace the password in the snippet above with a strong value.
The collector creates the schema for logs, traces, and metrics inside the otel database on first use. For more guidance on production user setup, see Going to production.
Adapt your collector configuration
Extend your existing collector configuration to write to Managed ClickStack via the ClickHouse exporter.
If you're using your own distribution, ensure it includes the ClickHouse exporter. The upstream contrib image already does.
Below is an example configuration that uses the ClickHouse exporter with the receivers, processors, and pipelines expected by the ClickStack UI. It matches the behavior of the ClickStack distribution, including the Session Replay (rrweb) routing path. Substitute <clickhouse_cloud_endpoint> and <your_password_here> with the credentials for the hyperdx_ingest user created above:
A few things to note:
- The
otlp/hyperdxreceiver listens on both gRPC (4317) and HTTP (4318); applications and agents should target these ports on your collector host. - The
clickhouseexporter writes logs, traces, and metrics into theoteldatabase, matching the layout the ClickStack UI expects. Theclickhouse/rrwebexporter handles Session Replay events routed by therouting/logsconnector intootel.hyperdx_sessions. - Authentication on the OTLP receivers is left to your existing setup. Configure it via collector extensions (for example
bearertokenauth) or a TLS-fronted reverse proxy if you need to require an ingestion token.
Reload your collector with the new configuration. Applications, SDKs, and agent collectors should then send to the OTLP endpoints exposed by your collector with whatever auth header your setup expects.
For further details on configuring OpenTelemetry collectors against Managed ClickStack, see Ingesting with OpenTelemetry.
Verify the endpoint
Generate some synthetic traffic against your collector to confirm the full pipeline works. We use telemetrygen, the OpenTelemetry Collector Contrib generator, which emits OTLP logs, traces, and metrics and exposes flags to shape the data across services, severities, span statuses, and metric types.
Run it from its Docker image (no install required). Substitute <your-collector-host> with the host your collector listens on, and set the authorization header (or alternative auth method) to whatever your collector expects:
Or install the binary with Go:
Each tg run lasts about 20 seconds (set by --duration 20s) and streams verbose logs the whole time, that's expected; each run returns on its own once its 20 seconds elapse. The logs below are enough to confirm the pipeline; the optional richer set adds several more runs and takes a few minutes.
Define a small tg helper so each command only specifies what varies (service, severity, status, attributes):
Send logs as a realistic mix of severities across services, mostly informational with a warning and an error rather than one uniform error stream:
Logs alone confirm the endpoint is working. For a richer demo dataset, a multi-service Service Map and charts across metric types, expand and run the commands below as well. They reuse the Send multi-span traces from several healthy services plus one failing dependency. This gives the Service Map a realistic shape, mostly healthy with one erroring service, and still populates the error views: Send metrics across the three common types, so charts have a counter, a gauge, and a distribution: For even more variety, add a couple more services and an exponential histogram:tg helper, so run them in the same shell.Generate richer telemetry (optional)
For the full set of flags and more variations, see Synthetic data with telemetrygen.
Confirm in the ClickStack UI
Open your service in the ClickHouse Cloud console and select ClickStack from the left menu and then Start Ingestion.
The next step can be skipped, as you've already configured your collector. Click Launch ClickStack to continue.
ClickStack will open in a new tab and you should be automatically directed to the Getting Started page. If not, select Getting Started from the left-hand menu, then click Start Ingestion followed by Next.
You'll land on the Getting Started page. If you're prompted to begin ingestion, proceed through the onboarding screens that guide you to start a Docker collector. Since you've already completed that step, you can simply click through them. ClickStack will automatically detect your telemetry data and tables, after which you can select Start Exploring to begin using the platform.
Switch the source to Logs and set the time range to Last 15 minutes. The synthetic logs from telemetrygen should appear within a few seconds.
If nothing shows up:
- Confirm the auth header value passed to
telemetrygenmatches the one your collector expects. - Tail your collector's logs and look for export errors.
- Verify the ClickHouse endpoint configured on the collector includes both the protocol and port (
https://...:8443).
Next steps: send your own data
The synthetic burst above only proves the pipeline works. To start sending real telemetry, instrument your own services with the ClickStack SDKs, which provide instrumentation for Node.js, Python, Go, Java, and other languages that export OTLP to the collector endpoint you just verified. For a complete worked example, follow Instrument an application.
To collect from infrastructure rather than application code:
- Monitoring Kubernetes: collect logs, infrastructure metrics, and Kubernetes events from a cluster.
- Monitoring AWS CloudWatch logs: forward CloudWatch logs via the OpenTelemetry CloudWatch receiver.
Further reading
This guide covers a single collector instance in its simplest form. The OpenTelemetry collector reference covers what to do next:
- Deploying the collector in Kubernetes with the upstream OpenTelemetry Helm chart and the ClickStack collector image.
- Securing the collector with TLS on the OTLP endpoint and least-privilege ingestion users.
- Processing, filtering, and enriching events at the gateway.
- Extending the collector configuration with custom receivers, processors, and pipelines.
- Estimating resources for gateway and agent deployments at your expected throughput.
- Going to production