> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickStack - sample logs, traces and metrics

> Getting started with ClickStack and a sample dataset with logs, sessions, traces and metrics

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

This guide demonstrates both ClickStack Open Source and Managed ClickStack using a sample data set.

<Tabs>
  <Tab title="Managed ClickStack">
    The following guide assumes you have completed the [Getting Started Guide for Managed ClickStack](/clickstack/deployment/managed) and have the [connection credentials recorded](/clickstack/getting-started/managed#next-steps).

    <Steps>
      <Step>
        <h3 id="select-your-service-managed">
          Select your service
        </h3>

        Select the service with Managed ClickStack from the main ClickHouse cloud landing page.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/select_service.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=e555abb187c8e9b22642959525b43d3a" alt="Select Service" size="lg" width="3600" height="2040" data-path="images/clickstack/select_service.png" />
      </Step>

      <Step>
        <h3 id="navigate-to-the-hyperdx-ui-managed">
          Navigate to the ClickStack UI (HyperDX)
        </h3>

        Select `ClickStack` from the left menu to navigate to the ClickStack UI, where you will be automatically authenticated.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/nRXhrvIyBMY7rv-q/images/use-cases/observability/hyperdx.png?fit=max&auto=format&n=nRXhrvIyBMY7rv-q&q=85&s=65be313d3d99e6f0a6836f599257183c" alt="ClickStack UI" size="lg" width="3430" height="2340" data-path="images/use-cases/observability/hyperdx.png" />
      </Step>

      <Step>
        <h3 id="download-sample-data-managed">
          Download sample data
        </h3>

        In order to populate the UI with sample data, download the following file:

        [Sample data](https://storage.googleapis.com/hyperdx/sample.tar.gz)

        ```shell theme={null}
        # curl
        curl -O https://storage.googleapis.com/hyperdx/sample.tar.gz
        # or
        # wget https://storage.googleapis.com/hyperdx/sample.tar.gz
        ```

        This file contains example logs, metrics, and traces from our public [OpenTelemetry demo](https://github.com/ClickHouse/opentelemetry-demo) - a simple e-commerce store with microservices. Copy this file to a directory of your choosing.
      </Step>

      <Step>
        <h3 id="load-sample-data-managed">
          Load sample data
        </h3>

        To load this data, we simply send it to the HTTP endpoint of the deployed OpenTelemetry (OTel) collector.

        Run the following command to send the data to the OTel collector:

        ```shell theme={null}
        for filename in $(tar -tf sample.tar.gz); do
          endpoint="http://localhost:4318/v1/${filename%.json}"
          echo "loading ${filename%.json}"
          tar -xOf sample.tar.gz "$filename" | while read -r line; do
            printf '%s\n' "$line" | curl -s -o /dev/null -X POST "$endpoint" \
            -H "Content-Type: application/json" \
            -H "authorization: ${CLICKSTACK_API_KEY}" \
            --data-binary @-
          done
        done
        ```

        This simulates OTLP log, trace, and metric sources sending data to the OTel collector. In production, these sources may be language clients or even other OTel collectors.

        Returning to the `Search` view, you should see that data has started to load (adjust the time frame to the `Last 1 hour` if the data doesn't render):

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-10.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=a798339d2272d65b783ba2ecdfded898" alt="HyperDX search" size="lg" width="3430" height="2340" data-path="images/use-cases/observability/hyperdx-10.png" />

        Data loading will take a few minutes. Allow for the load to be completed before progressing to the next steps.
      </Step>

      <Step>
        <h3 id="explore-sessions-managed">
          Explore sessions
        </h3>

        Suppose we have reports that our users are experiencing issues paying for goods. We can view their experience using HyperDX's session replay capabilities.

        Select `Client Sessions` from the left menu.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-11.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=cd351ef2c1689d49ea510a75b34ed0a5" alt="Sessions" size="lg" width="4852" height="2890" data-path="images/use-cases/observability/hyperdx-11.png" />

        This view allows us to see front-end sessions for our e-commerce store. Sessions remain Anonymous until users check out and try to complete a purchase.

        Note that some sessions with emails have an associated error, potentially confirming reports of failed transactions.

        Select a trace with a failure and associated email. The subsequent view allows us to replay the user's session and review their issue. Press play to watch the session.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-12.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=d2929bf9b00c8450356797d12d794c73" alt="Session replay" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-12.png" />

        The replay shows the user navigating the site, adding items to their cart. Feel free to skip to later in the session where they attempt to complete a payment.

        <Tip>
          Any errors are annotated on the timeline in red.
        </Tip>

        The user was unable to place the order, with no obvious error. Scroll to the bottom of the left panel, containing the network and console events from the user's browser. You will notice a 500 error was thrown on making a `/api/checkout` call.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-13.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=fb6e74b6054849df61cd9206f59aa087" alt="Error in session" size="lg" width="4874" height="2892" data-path="images/use-cases/observability/hyperdx-13.png" />

        Select this `500` error. Neither the `Overview` nor `Column Values` indicate the source of the issue, other than the fact the error is unexpected, causing an `Internal Error`.
      </Step>

      <Step>
        <h3 id="explore-traces-managed">
          Explore traces
        </h3>

        Navigate to the `Trace` tab to see the full distributed trace.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-14.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=13904b3e1e4dcf476bb9cbecf2fe292a" alt="Session trace" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-14.png" />

        Scroll down the trace to see the origin of the error - the `checkout` service span. Select the `Payment` service span.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-15.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=aed48602717766bcb4573cf58b9486d8" alt="Span" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-15.png" />

        Select the tab `Column Values` and scroll down. We can see the issue is associated with a cache being full.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-16.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=aaf802f94c3209d09feb7906d4edd89f" alt="Column values" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-16.png" />

        Scrolling up and returning to the trace, we can see logs are correlated with the span, thanks to our earlier configuration. These provide further context.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-17.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=e407fbadbbc6e47f495200ef8b208d06" alt="Correlated log" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-17.png" />

        We've established that a cache is getting filled in the payment service, which is preventing payments from completing.
      </Step>

      <Step>
        <h3 id="explore-logs-managed">
          Explore logs
        </h3>

        For further details, we can return to the `Search`:

        Select `Logs` from the sources and apply a filter to the `payment` service.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-18.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=ebd9b79de3207e0d42df1ad63284003b" alt="Logs" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-18.png" />

        We can see that while the issue is recent, the number of impacted payments is high. Furthermore, a cache related to the visa payments appears to be causing issues.
      </Step>

      <Step>
        <h3 id="chart-metrics-managed">
          Chart metrics
        </h3>

        While an error has clearly been introduced in the code, we can use metrics to confirm the cache size. Navigate to the `Chart Explorer` view.

        Select `Metrics` as the data source. Complete the chart builder to plot the `Maximum` of `visa_validation_cache.size (Gauge)` and press the play button. The cache was clearly increasing before reaching a maximum size, after which errors were generated.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-19.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=b3c1b62d09d8f9bc03b314538900368d" alt="Metrics" size="lg" width="3600" height="1856" data-path="images/use-cases/observability/hyperdx-19.png" />
      </Step>
    </Steps>
  </Tab>

  <Tab title="ClickStack Open Source">
    The following example assumes you have started Open Source ClickStack using the [instructions for the all-in-one image](/clickstack/getting-started/oss) and connected to the [local ClickHouse instance](/clickstack/getting-started/oss#complete-connection-credentials).

    <Steps>
      <Step>
        <h3 id="navigate-to-the-hyperdx-ui">
          Navigate to the ClickStack UI (HyperDX)
        </h3>

        Visit [http://localhost:8080](http://localhost:8080) to access the ClickStack UI.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/nRXhrvIyBMY7rv-q/images/use-cases/observability/hyperdx.png?fit=max&auto=format&n=nRXhrvIyBMY7rv-q&q=85&s=65be313d3d99e6f0a6836f599257183c" alt="ClickStack UI" size="lg" width="3430" height="2340" data-path="images/use-cases/observability/hyperdx.png" />
      </Step>

      <Step>
        <h3 id="copy-ingestion-api-key">
          Copy ingestion API key
        </h3>

        Navigate to [`Team Settings`](http://localhost:8080/team) and copy the `Ingestion API Key` from the `API Keys` section. This API key ensures data ingestion through the OpenTelemetry collector is secure.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/copy_api_key.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=e39c10fdea168d26a4a82c4da09338b7" alt="Copy API key" size="lg" width="3600" height="1856" data-path="images/use-cases/observability/copy_api_key.png" />
      </Step>

      <Step>
        <h3 id="download-sample-data">
          Download sample data
        </h3>

        In order to populate the UI with sample data, download the following file:

        [Sample data](https://storage.googleapis.com/hyperdx/sample.tar.gz)

        ```shell theme={null}
        # curl
        curl -O https://storage.googleapis.com/hyperdx/sample.tar.gz
        # or
        # wget https://storage.googleapis.com/hyperdx/sample.tar.gz
        ```

        This file contains example logs, metrics, and traces from our public [OpenTelemetry demo](https://github.com/ClickHouse/opentelemetry-demo) - a simple e-commerce store with microservices. Copy this file to a directory of your choosing.
      </Step>

      <Step>
        <h3 id="load-sample-data">
          Load sample data
        </h3>

        To load this data, we simply send it to the HTTP endpoint of the deployed OpenTelemetry (OTel) collector.

        First, export the API key copied above.

        ```shell theme={null}
        # export API key
        export CLICKSTACK_API_KEY=<YOUR_INGESTION_API_KEY>
        ```

        Run the following command to send the data to the OTel collector:

        ```shell theme={null}
        for filename in $(tar -tf sample.tar.gz); do
          endpoint="http://localhost:4318/v1/${filename%.json}"
          echo "loading ${filename%.json}"
          tar -xOf sample.tar.gz "$filename" | while read -r line; do
            printf '%s\n' "$line" | curl -s -o /dev/null -X POST "$endpoint" \
            -H "Content-Type: application/json" \
            -H "authorization: ${CLICKSTACK_API_KEY}" \
            --data-binary @-
          done
        done
        ```

        This simulates OTLP log, trace, and metric sources sending data to the OTel collector. In production, these sources may be language clients or even other OTel collectors.

        Returning to the `Search` view, you should see that data has started to load (adjust the time frame to the `Last 1 hour` if the data doesn't render):

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-10.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=a798339d2272d65b783ba2ecdfded898" alt="HyperDX search" size="lg" width="3430" height="2340" data-path="images/use-cases/observability/hyperdx-10.png" />

        Data loading will take a few minutes. Allow for the load to be completed before progressing to the next steps.
      </Step>

      <Step>
        <h3 id="explore-sessions">
          Explore sessions
        </h3>

        Suppose we have reports that our users are experiencing issues paying for goods. We can view their experience using HyperDX's session replay capabilities.

        Select [`Client Sessions`](http://localhost:8080/sessions?from=1747312320000\&to=1747312920000\&sessionSource=l1324572572) from the left menu.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-11.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=cd351ef2c1689d49ea510a75b34ed0a5" alt="Sessions" size="lg" width="4852" height="2890" data-path="images/use-cases/observability/hyperdx-11.png" />

        This view allows us to see front-end sessions for our e-commerce store. Sessions remain Anonymous until users check out and try to complete a purchase.

        Note that some sessions with emails have an associated error, potentially confirming reports of failed transactions.

        Select a trace with a failure and associated email. The subsequent view allows us to replay the user's session and review their issue. Press play to watch the session.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-12.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=d2929bf9b00c8450356797d12d794c73" alt="Session replay" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-12.png" />

        The replay shows the user navigating the site, adding items to their cart. Feel free to skip to later in the session where they attempt to complete a payment.

        <Tip>
          Any errors are annotated on the timeline in red.
        </Tip>

        The user was unable to place the order, with no obvious error. Scroll to the bottom of the left panel, containing the network and console events from the user's browser. You will notice a 500 error was thrown on making a `/api/checkout` call.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-13.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=fb6e74b6054849df61cd9206f59aa087" alt="Error in session" size="lg" width="4874" height="2892" data-path="images/use-cases/observability/hyperdx-13.png" />

        Select this `500` error. Neither the `Overview` nor `Column Values` indicate the source of the issue, other than the fact the error is unexpected, causing an `Internal Error`.
      </Step>

      <Step>
        <h3 id="explore-traces">
          Explore traces
        </h3>

        Navigate to the `Trace` tab to see the full distributed trace.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-14.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=13904b3e1e4dcf476bb9cbecf2fe292a" alt="Session trace" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-14.png" />

        Scroll down the trace to see the origin of the error - the `checkout` service span. Select the `Payment` service span.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-15.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=aed48602717766bcb4573cf58b9486d8" alt="Span" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-15.png" />

        Select the tab `Column Values` and scroll down. We can see the issue is associated with a cache being full.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-16.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=aaf802f94c3209d09feb7906d4edd89f" alt="Column values" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-16.png" />

        Scrolling up and returning to the trace, we can see logs are correlated with the span, thanks to our earlier configuration. These provide further context.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-17.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=e407fbadbbc6e47f495200ef8b208d06" alt="Correlated log" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-17.png" />

        We've established that a cache is getting filled in the payment service, which is preventing payments from completing.
      </Step>

      <Step>
        <h3 id="explore-logs">
          Explore logs
        </h3>

        For further details, we can return to the [`Search` view](http://localhost:8080/search):

        Select `Logs` from the sources and apply a filter to the `payment` service.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-18.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=ebd9b79de3207e0d42df1ad63284003b" alt="Logs" size="lg" width="4874" height="2890" data-path="images/use-cases/observability/hyperdx-18.png" />

        We can see that while the issue is recent, the number of impacted payments is high. Furthermore, a cache related to the visa payments appears to be causing issues.
      </Step>

      <Step>
        <h3 id="chart-metrics">
          Chart metrics
        </h3>

        While an error has clearly been introduced in the code, we can use metrics to confirm the cache size. Navigate to the `Chart Explorer` view.

        Select `Metrics` as the data source. Complete the chart builder to plot the `Maximum` of `visa_validation_cache.size (Gauge)` and press the play button. The cache was clearly increasing before reaching a maximum size, after which errors were generated.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-19.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=b3c1b62d09d8f9bc03b314538900368d" alt="Metrics" size="lg" width="3600" height="1856" data-path="images/use-cases/observability/hyperdx-19.png" />
      </Step>
    </Steps>
  </Tab>
</Tabs>
