---
title: "ClickHouse"
description: "Adds instrumentation for the ClickHouse JavaScript clients. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/clickhouse/
---

# ClickHouse for AWS Lambda (JavaScript)

Available since: `v11.17.0`

*Import name: `Sentry.clickhouseIntegration`*

This integration is enabled by default when [tracing](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/tracing.md) is enabled. To customize it, see [Modifying Default Integrations](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations.md#modifying-default-integrations).

The `clickhouseIntegration` adds instrumentation for the official ClickHouse clients: [`@clickhouse/client`](https://www.npmjs.com/package/@clickhouse/client) for Node.js and [`@clickhouse/client-web`](https://www.npmjs.com/package/@clickhouse/client-web) for web runtimes such as Cloudflare Workers. It creates a `db` span for each statement the client sends, so slow or failing ClickHouse queries show up in your traces.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  tracesSampleRate: 1.0,
  integrations: [Sentry.clickhouseIntegration()],
});
```

## [Supported Operations](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/clickhouse.md#supported-operations)

The integration traces these `ClickHouseClient` methods:

* `query()`
* `command()`
* `exec()`
* `insert()`

`ping()` and `close()` don't send a statement, so they don't create spans. An `insert()` with an empty `values` array doesn't send a request and doesn't create a span either.

The integration only creates spans inside an active span, such as a request handler or a span you start with [`Sentry.startSpan()`](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/tracing/instrumentation.md).

## [Spans](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/clickhouse.md#spans)

The integration names each span after the operation and its table, for example `SELECT events`. In the query text, it replaces string and number literals with `?` and removes comments and inline data. It doesn't record `query_params` values or inserted rows.

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/clickhouse.md#supported-versions)

* `@clickhouse/client`: `>=1.1.0 <2`
* `@clickhouse/client-web`: `>=1.1.0 <2`
