---
title: "Building an Observability Solution with ClickHouse - Part 2 - Traces"
description: "Trace data from OpenTelemetry-instrumented services can be stored and queried in ClickHouse, treating spans as rows in a single analytics table and visualizing them in Grafana."
url: "https://swe.quest/articles/building-an-observability-solution-with-clickhouse-part-2-traces-1a2db2608573ffa7"
canonical: "https://clickhouse.com/blog/storing-traces-and-spans-open-telemetry-in-clickhouse"
source: "ClickHouse"
published: "2023-03-29"
difficulty: "medium"
kind: "How-to"
reading_minutes: 29
tags: ["observability","analytics","microservices"]
---

# Building an Observability Solution with ClickHouse - Part 2 - Traces

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-03-29, 29 min read, How-to. Original: [https://clickhouse.com/blog/storing-traces-and-spans-open-telemetry-in-clickhouse](https://clickhouse.com/blog/storing-traces-and-spans-open-telemetry-in-clickhouse)

## Summary

Trace data from OpenTelemetry-instrumented services can be stored and queried in ClickHouse, treating spans as rows in a single analytics table and visualizing them in Grafana. The walkthrough uses a ClickHouse fork of the OpenTelemetry Demo, configuring the OTEL Collector's contrib ClickHouse exporter with batching (5s or 100k spans), retries, TTL-based retention and secure endpoints, deployable via Docker Compose or Helm. Practical caveats include the exporter's hard-coded schema (pre-create tables to control types and codecs), its alpha status, and the need to pre-create non-default databases, followed by tips on schema optimization for the otel\_traces table.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Microservices](https://swe.quest/tags/microservices.md) (Backend & APIs)

## Prerequisites

- distributed tracing concepts ([easy posts on Observability](https://swe.quest/tags/observability.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- Docker or Kubernetes basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))

## Keywords

ClickHouse, OpenTelemetry, OTEL Collector, OTLP, Grafana, OpenTelemetry Demo

## Related posts

- [How we used ClickHouse to store OpenTelemetry Traces and up our Observability Game](https://swe.quest/articles/how-we-used-clickhouse-to-store-opentelemetry-traces-and-up-our-observability-b78dc8bc485a8f13.md): ClickHouse · 2023-04-14 · Medium · 13 min read · Observability, Analytics & OLAP, SQL, Cost optimization
  Resmo stores over 300 million unsampled OpenTelemetry spans per day in a self-hosted ClickHouse node, after dropping S3/Parquet/Athena because of its 2-3 second query startup and delayed data.
- [ClickHouse and OpenTelemetry](https://swe.quest/articles/clickhouse-and-opentelemetry-84cdeb7807e844a6.md): ClickHouse · 2024-11-07 · Medium · 10 min read · Observability, Analytics & OLAP, Databases, Open source
  ClickHouse now officially supports the OpenTelemetry Collector exporter for ClickHouse, which has reached beta for logs and traces.
- [IBM Instana’s solution for monitoring ClickHouse performance](https://swe.quest/articles/ibm-instana-s-solution-for-monitoring-clickhouse-performance-2d8ea3511eb7a606.md): ClickHouse · 2025-01-17 · Easy · 4 min read · Observability, Analytics & OLAP, Databases
  IBM Instana, which stores its telemetry in ClickHouse, built a custom span exporter to trace ClickHouse's own query execution without adding load or invasive changes to customer systems.
- [Goodbye limitations, hello data: How Qonto is rethinking observability with ClickHouse Cloud](https://swe.quest/articles/goodbye-limitations-hello-data-how-qonto-is-rethinking-observability-with-756d9cefa803d826.md): ClickHouse · 2026-05-01 · Easy · 8 min read · Observability, Analytics & OLAP, AI agents, Cost optimization
  Qonto, a European digital bank, moved trace storage from Grafana Tempo to ClickHouse Cloud, extending query windows from 2-3 hours to two weeks without sampling and adopting a wide-events model instead of the logs/metrics/traces pillars.
- [Building an Observability Solution with ClickHouse at Dash0](https://swe.quest/articles/building-an-observability-solution-with-clickhouse-at-dash0-f950ba66eb3161c6.md): ClickHouse · 2025-04-07 · Hard · 18 min read · Analytics & OLAP, Observability, Storage engines, Databases, Cost optimization
  Dash0 stores all OpenTelemetry metrics, logs and spans in ClickHouse, using PostgreSQL only for customer settings, so signals can be joined and correlated in one system.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
