Back to Blog
ObservabilityClickHouseOpenTelemetry

ClickHouse: Your Production Debugger, Not Just Another Dashboard

Incident resolution isn't slow because you lack data; it's slow because your data is fragmented, siloed, and often impossible to correlate without heroic effort. The real breakthrough isn't more dashboards or isolated logs; it's a unified, high-cardinality database like ClickHouse that turns disparate telemetry into an interactive production debugger.

November 19, 2026
6 min read
RS
Raju Shanigarapu

Incident resolution isn't slow because you lack data; it's slow because your data is fragmented, siloed, and often impossible to correlate without heroic effort. Teams meticulously build separate stacks for logs, metrics, and traces, then express surprise when their engineers spend hours hopping between UIs, manually stitching together context from different timestamps and identifiers. This "best practice" of separate observability pillars is a self-inflicted wound, guaranteeing a slower mean time to resolution because it fundamentally misunderstands the debugging process.

The Illusion of Separate Observability Pillars

Every engineering team has been there: a critical incident erupts, and the first responders frantically open Grafana for metrics, then switch to Loki for logs, then to Jaeger for traces. Each tool is excellent at its specific job, but the cognitive load of correlating information across these disparate systems is immense. You're constantly hunting for common identifiers, wrestling with inconsistent time synchronisation, and context-switching between different query languages and UI paradigms. This isn't observability; it's a glorified scavenger hunt.

This fragmented approach persists because it’s the default, often driven by a perceived need for "best-of-breed" tools for each telemetry type. The result is a patchwork architecture that aggregates data in silos, rather than unifying it. You end up with mountains of data, but no single pane of glass that truly connects the dots, leaving engineers to manually bridge the gaps under immense pressure. It's a system designed for observation, not for rapid diagnosis and resolution.

ClickHouse Demands Data Cohesion

ClickHouse, a columnar database management system, forces a re-evaluation of this fragmented model. It's built for analytical queries over massive datasets, excelling at high-cardinality data — precisely what modern observability demands. When you feed your OpenTelemetry data into ClickHouse, you're not just storing logs, metrics, and traces; you're creating a single, highly-indexed data lake where every piece of telemetry from a given operation shares common identifiers.

The magic here isn't just ClickHouse's speed; it's its schema flexibility and SQL query power. Instead of separate data stores, you define tables for traces, logs, and metrics within the same database, allowing trace_id and span_id to become the universal foreign keys. This design naturally encourages a unified approach to data collection and querying, eliminating the need for complex, often lossy, correlation engines or separate UIs. It turns your entire application's runtime data into a single, queryable graph.

Traces, Logs, Metrics: One Query Away

The true power of a ClickHouse-backed observability platform reveals itself during incident response when you can join disparate telemetry types in a single SQL query. Instead of navigating separate dashboards, you can ask questions like, "Show me all log messages associated with this slow trace, along with the system metrics for the host it ran on." This isn't possible with siloed tools without significant, often custom, integration work.

Consider an OpenTelemetry setup. Every log, every span, every metric point can be enriched with trace_id, span_id, service.name, host.name, and any other relevant attributes. When this data lands in ClickHouse, these attributes become columns. Correlating a specific user's journey (via session ID), an application trace, and the underlying infrastructure health is no longer a task for multiple browser tabs; it's a single, powerful SQL statement. This dramatically reduces the time spent gathering context and allows engineers to focus on root cause analysis.

Session Replays: The Missing Link in Production Debugging

Traditional logs, metrics, and traces, even when unified, sometimes fail to capture the user's actual experience. A trace might show a slow API call, and logs might show an error, but what did the user see? Did they encounter a broken UI? Were they stuck on a loading spinner? Session replays, when integrated into the same observability platform, bridge this critical gap.

ClickStack's ability to unify session replays alongside other telemetry is a game-changer. Imagine an engineer troubleshooting an error and, with a single click, being able to jump from an error log in ClickHouse directly to the exact moment in a user's session where that error occurred. This provides invaluable visual context, allowing for a complete understanding of the user impact and the sequence of events leading to the issue. It transforms abstract technical data into concrete user experiences, accelerating problem identification and validation of fixes.

Example: Correlating a Slow Trace with User Behavior

Let's illustrate this with a simple Python Flask application instrumented with OpenTelemetry. We'll send traces and logs, demonstrating how they can be correlated.

First, our Python application app.py:

from flask import Flask, request
from opentelemetry import trace
from opentel_logging import setup_otel_logging # Custom module for OTel setup
import logging
import time

# Configure OpenTelemetry Logging and Tracing
setup_otel_logging("my-service")
tracer = trace.get_tracer(__name__)
logger = logging.getLogger(__name__)

app = Flask(__name__)

@app.route('/')
def hello_world():
    with tracer.start_as_current_span("hello_endpoint"):
        logger.info("Request received for /")
        time.sleep(0.05) # Simulate some work
        return "Hello, World!"

@app.route('/slow')
def slow_endpoint():
    with tracer.start_as_current_span("slow_endpoint"):
        logger.warning("Simulating a slow operation.")
        time.sleep(0.2) # Simulate slow work
        if request.args.get('error'):
            logger.error("An intentional error occurred in /slow.", extra={"error_code": 500})
            raise ValueError("Simulated error from /slow")
        return "That was slow!"

if __name__ == '__main__':
    app.run(debug=True, port=5000)

And our opentel_logging.py to set up OpenTelemetry globally. For a runnable example, we'll use console exporters, but in production, these would be OTLP exporters sending to an OpenTelemetry Collector (which then forwards to ClickHouse).

import logging
from opentel.sdk.resources import Resource
from opentel.sdk.trace import TracerProvider
from opentel.sdk.trace.export import ConsoleSpanExporter, BatchSpanProcessor
from opentel.instrumentation.logging import LoggingInstrumentor
from opentel.sdk._logs import LoggerProvider, set_logger_provider
from opentel.sdk._logs.export import ConsoleLogExporter, BatchLogProcessor
from opentel.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
from opentel.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentel.propagate import set_global_textmap
from opentel.propagators.b3 import B3MultiFormat # Example propagator

def setup_otel_logging(service_name: str):
    # 1. Resource definition for all telemetry
    resource = Resource.create({"service.name": service_name, "service.version": "1.0.0"})

    # 2. Configure OpenTelemetry Tracing
    provider = TracerProvider(resource=resource)
    # In production, replace ConsoleSpanExporter with OTLPSpanExporter
    # otlp_span_exporter = OTLPSpanExporter(endpoint="localhost:4317", insecure=True)
    provider.add_span_processor(BatchSpanProcessor(ConsoleSpanExporter())) # For demonstration
    # provider.add_span_processor(BatchSpanProcessor(otlp_span_exporter)) # For real OTLP export
    trace.set_tracer_provider(provider)

    # 3. Configure OpenTelemetry Logging
    # Instrument standard Python logging to automatically add trace/span IDs
    LoggingInstrumentor().instrument(set_logging_format=True)

    # Configure a logger provider for explicit OTLP log export if needed
    # logger_provider = LoggerProvider(resource=resource)
    # otlp_log_exporter = OTLPLogExporter(endpoint="localhost:4317", insecure=True)
    # logger_provider.add_log_record_processor(BatchLogProcessor(ConsoleLogExporter())) # For demonstration
    # logger_provider.add_log_record_processor(BatchLogProcessor(otlp_log_exporter)) # For real OTLP export
    # set_logger_provider(logger_provider) # Set globally if using explicit logger provider

    # Ensure root logger outputs to console for demonstration
    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    if not root_logger.handlers: # Add a handler if none exists
        handler = logging.StreamHandler()
        # LoggingInstrumentor (with set_logging_format=True) modifies formatters
        # to include trace_id and span_id, so a basic formatter is sufficient here.
        formatter = logging.Formatter('%(levelname)s [%(name)s] %(message)s')
        handler.setFormatter(formatter)
        root_logger.addHandler(handler)

    # Optional: Configure a text map propagator for context propagation across services
    set_global_textmap(B3MultiFormat())

    logging.info(f"OpenTelemetry logging and tracing configured for service: {service_name}")

To run this:

  1. pip install Flask opentelemetry-sdk opentelemetry-instrumentation-logging opentelemetry-exporter-otlp opentelemetry-propagators-b3
  2. Run python app.py
  3. Access http://localhost:5000/slow?error=true in your browser. You'll see logs on the console with trace_id and span_id injected.

Now, imagine these logs and traces are sent via OTLP to a ClickHouse instance. A ClickHouse query to correlate a specific slow trace with its associated logs would look like this:

SELECT
    t.trace_id,
    t.span_id,
    t.name AS span_name,
    t.duration_ms,
    l.timestamp,
    l.severity_text,
    l.body AS log_message,
    l.attributes['error_code

Want to build systems that work this way?

I work with QA engineers and engineering teams on automation architecture, framework audits, and AI-powered quality systems.

Get posts like this in your inbox

No fluff. Sharp takes on QA, AI, and engineering — once a week.

Sent with MailerLite. See the privacy policy.