RousselTMLEARNING

TP · ClickStack: from discovery to expertise

Lab: installing ClickStack and sending your first data with correction

The correction is integrated into the TP (See the green boxes)

What you will learn in this TP
  • Deploy the all-in-one container with volumes
  • Use the ingestion key
  • Send traces and logs over OTLP
  • Search by properties and in SQL
  • Check persistence

Introduction #

What you will learn in this section
  • Deploy the all-in-one container with volumes
  • Use the ingestion key
  • Send traces and logs over OTLP
  • Search by properties and in SQL
  • Check persistence

Context. You are evaluating ClickStack for your team. You need a demo instance that keeps its data from one day to the next and realistic data to show.

Prerequisites: a machine with Docker (4 GB free memory), curl and jq  ·  Estimated time: 45 min

A persistent ClickStack instance fed with traces and logs, explored by search and in SQL.

Setup #

Guided steps, with their solution.

  1. 1. Start ClickStack

    Why? Without volumes, everything would be lost when the container is removed.

    Start the clickhouse/clickstack-all-in-one container with the three volumes (MongoDB, ClickHouse data and logs) on an obs Docker network.
    See the correction
    docker network create obs 2>/dev/null
    mkdir -p .volumes/db .volumes/ch_data .volumes/ch_logs
    docker run -d --name clickstack --network obs --restart unless-stopped \
      -p 8080:8080 -p 4317:4317 -p 4318:4318 \
      -v "$(pwd)/.volumes/db:/data/db" \
      -v "$(pwd)/.volumes/ch_data:/var/lib/clickhouse" \
      -v "$(pwd)/.volumes/ch_logs:/var/log/clickhouse-server" \
      clickhouse/clickstack-all-in-one:latest
    docker logs -f clickstack     # wait for the UI to answer, then Ctrl+C
    curl -sI http://localhost:8080 | head -1
  2. 2. Create the account and get the ingestion key

    Why? The collector rejects requests without a key.

    Open http://localhost:8080, create the first account, then copy the key from Team Settings › API Keys into a variable.
    See the correction
    export KEY='<key copied from Team Settings › API Keys>'
    # test: without the key, the OTLP HTTP request is rejected (401 expected)
    curl -s -o /dev/null -w '%{http_code}\n' -X POST http://localhost:4318/v1/logs -H 'Content-Type: application/json' -d '{}'
  3. 3. Send traces and logs

    Why? telemetrygen produces realistic OTLP telemetry without writing an application.

    Send traces for the boutique and paiement services (including errors), then info and error logs.
    See the correction
    T='ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest'
    for s in boutique paiement; do
      docker run --rm --network obs $T traces --otlp-endpoint clickstack:4317 --otlp-insecure \
        --duration 30s --rate 20 --service $s --otlp-header "authorization=\"$KEY\""
    done
    docker run --rm --network obs $T traces --otlp-endpoint clickstack:4317 --otlp-insecure \
      --duration 10s --rate 5 --service paiement --status-code Error --otlp-header "authorization=\"$KEY\""
    docker run --rm --network obs $T logs --otlp-endpoint clickstack:4317 --otlp-insecure --duration 20s --rate 10 \
      --service boutique --body 'commande validée' --severity-text Info --severity-number 9 --otlp-header "authorization=\"$KEY\""
    docker run --rm --network obs $T logs --otlp-endpoint clickstack:4317 --otlp-insecure --duration 20s --rate 2 \
      --service paiement --body 'timeout banque' --severity-text Error --severity-number 17 --otlp-header "authorization=\"$KEY\"" 
  4. 4. Search and correlate

    Why? Property search covers most needs.

    In Search, Logs source: find paiement errors, then the exact phrase "timeout banque". Traces source: filter error spans and open a waterfall. Finally switch to SQL mode.
    See the correction
    service:paiement level:error
    "timeout banque"
    -level:info service:boutique
    # Traces
    service:paiement StatusCode:Error
    # SQL mode (WHERE condition)
    ServiceName = 'paiement' AND SeverityText = 'Error'
  5. 5. Check in SQL and test persistence

    Why? A demo that loses its data on restart convinces nobody.

    Count logs and spans per service with clickhouse-client, remove and recreate the container, and check the numbers and your account are still there.
    See the correction
    q() { docker exec clickstack clickhouse-client --query "$1"; }
    q "SELECT ServiceName, count() FROM otel_logs GROUP BY ServiceName"
    q "SELECT ServiceName, countIf(StatusCode = 'Error') AS errors, count() FROM otel_traces GROUP BY ServiceName"
    docker rm -f clickstack
    # rerun the docker run command from step 1, then:
    q "SELECT count() FROM otel_logs"     # same total as before; signing in to the UI still works

Difficulty level : ●●○○○ (2/5)

My progress

  • ⏱ Estimated time : ≈ 45 min

Sign in to track your progress and take notes. Sign in

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

ClickStack: architecture, components and offerings (ClickHouse, HyperDX, OpenTelemetry)

ClickStack, ClickHouse's official observability stack: role of ClickHouse, the UI (HyperDX), the ...

Installing and deploying ClickStack: all-in-one, Docker Compose, Helm and Managed ClickStack

Deploying ClickStack to fit the need: all-in-one container with persistence, Docker Compose and i...

Sending telemetry to ClickStack: OpenTelemetry SDKs, collectors, logs, Kubernetes and browser sessions

Feeding ClickStack: ingestion key, OpenTelemetry SDK variables, forwarding through an existing co...

Installing OpenObserve and ingesting your first data

Install OpenObserve with Docker Compose or the binary, configure it with its ZO_* variables, send...

Installing Phoenix and tracing your first LLM application

Install Arize Phoenix (pip, Docker), send your first OpenInference traces from an OpenAI applicat...

Exploring with the ClickStack UI: sources, search, traces, sessions and SQL

Using the ClickStack UI (HyperDX): data sources, property and full-text search syntax, SQL mode, ...

Alerts and dashboards in ClickStack

Building charts and dashboards in ClickStack, creating alerts on a search or a chart, sending the...

Installing Zabbix and monitoring your first host

Install Zabbix with Docker Compose (server, PostgreSQL, web interface), install agent 2 on a Linu...

Sending logs, metrics and traces to OpenObserve

OpenObserve receiving endpoints: JSON, bulk, OTLP with the OpenTelemetry Collector, Prometheus re...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!