The clickhouse integration provides an opinionated way to interact with ClickHouse as OLAP database for helix services.

Trace attributes

The clickhouse integration sets the following trace attributes:

  • clickhouse.database
  • span.kind

When applicable, these attributes can be set as well:

  • clickhouse.async_insert.wait
  • clickhouse.query


clickhouse.database: "my_db"
clickhouse.query: "SELECT id, username FROM users;"
span.kind: "server"


The integration uses the official Go library maintained by the ClickHouse team.

Install the Go module with:

$ go get

Simple example on how to import, configure, and use the integration:

import (


func main() {
  cfg := clickhouse.Config{
    Addresses: []string{""},
    Database:  "default",

  db, err := clickhouse.Connect(cfg)
  if err != nil {
    return err

  ctx := context.Background()
  rows, err := db.Query(ctx, "QUERY", args...)
  if err != nil {
    // ...

  defer rows.Close()
  for rows.Next() {
    // ...

  if err := service.Start(); err != nil {

  if err := service.Close(); err != nil {

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed. Thank you for your contributions!
Built by