---
title: "Trace and analyze Goose sessions with OpenTelemetry, Jaeger and ClickHouse"
date: "2026-10-02"
author: "Vikram Vaswani"
url: "https://aaif.io/blog/trace-and-analyze-goose-sessions-with-opentelemetry-jaeger-and-clickhouse"
---

# Trace and analyze Goose sessions with OpenTelemetry, Jaeger and ClickHouse

_Use OpenTelemetry, Jaeger, and ClickHouse to trace Goose sessions, identify where latency comes from, inspect agent and tool activity, and persist telemetry for later analysis._

I asked Goose “how are you?” and it took 14 seconds to answer.

That got me wondering: why did it take so long? Was it the model? The network? The agent itself?

I decided to try and find out. Goose has built-in [OpenTelemetry](https://opentelemetry.io/) support, so it was easy enough to wire it up to Jaeger for distributed tracing. I also added ClickHouse so the traces would survive a restart.

## **Stack**

My stack consisted of three components:

- [Goose](https://goose-docs.ai/), a general-purpose AI agent hosted by the [Agentic AI Foundation (AAIF)](https://aaif.io/). It’s open source, runs locally, connects to a model provider of your choice (I used [OpenRouter](https://openrouter.ai/)), and supports reusable recipes for repetitive tasks.


- [Jaeger](https://www.jaegertracing.io/), an open source, distributed tracing platform. It provides a framework to monitor and troubleshoot distributed workflows, identify performance bottlenecks, and trace root causes of errors.


- [ClickHouse](https://clickhouse.com/), a high-performance, column-oriented database for real-time analytics and observability. It’s open source, handles large volumes of data efficiently, and is supported in Jaeger.


Goose is the agent. Jaeger provides deep observability. ClickHouse stores the results.

Here’s how these three components connect:

![Architecture diagram showing Goose sending trace data to Jaeger, with ClickHouse providing persistent trace storage.](https://cdn.sanity.io/images/4o10fa7h/production/57fd38ca2a38ca30ed7a1b763d27836527b1b4b9-1581x335.png?w=1200)

## **Goose**

I already had Goose installed and configured, so I didn’t need to set it up again. If you’re starting from scratch, installing it takes one command:

Then, configure it to use a model provider. I used [OpenRouter](https://openrouter.ai/) with a free-tier model, `qwen/qwen3.8-27b:free`:

## **Jaeger**

The commands below are the ones I used, so you can follow along if you’d like.

Once Goose was ready, the next step was to install Jaeger and connect the two. To keep things simple, I chose to use the Jaeger container image:

This command starts Jaeger in a container, exposing Jaeger’s web dashboard on host port 16686 and Jaeger’s data collector on host port 4318.

In the same shell session, I also [configured Goose to export telemetry](https://goose-docs.ai/docs/guides/environment-variables/#observability-configuration) to the Jaeger data collector endpoint:

By default, the OpenTelemetry stream does not capture prompt and completion message contents. To include this in the telemetry stream, I set the following additional environment variable:

NOTE: This is optional, and because it can expose prompt and completion content in telemetry, it should only be enabled where that data can be stored and accessed appropriately. 

## **Trace #1**

With the configuration out of the way, it was time to test things out:

This was a simple handshake to test the integration. To see the corresponding [trace](https://opentelemetry.io/docs/concepts/signals/traces/) in Jaeger, I opened the Jaeger web dashboard at http://localhost:16686, selected the newly minted `goose` service, clicked the `Find traces` button, and selected the most recent trace.

![Jaeger Search view with the Goose service selected and controls for finding traces.](https://cdn.sanity.io/images/4o10fa7h/production/e7cf988616e315c9a0fcc34f1064944ffc9e1a76-471x624.png?w=1200)

By default, the primary dashboard view for a trace is a nested tree of spans, representing individual units of work (like an API request, database query, or function call) arranged as a Gantt chart or waterfall view. Jaeger also records the duration of each span, so you can see which ones are taking the most time.

![Jaeger trace view showing a Goose reply span and nested model-call spans with their durations.](https://cdn.sanity.io/images/4o10fa7h/production/de98ebb596f3fc920b1b7ec80e3d6e2cf729de8a-1920x966.png?w=1200)

Clicking on any individual span expands it to display additional information, such as the actual request/response text, any key-value metadata, plus infrastructure details about where the code executed.

So, where did the 14 seconds go?

The trace has the answer. The entire `goose: reply` span took ~14 seconds, of which:

- The call to the model (`stream_response_from_provider`) took ~7 seconds, about half the total.

- This is because the model didn’t just reply; it also “thought” about the question (you can see this in the assistant output, which is split into two parts, a reasoning block followed by the actual answer).

- Goose also added context to my three-word question (the current time, working directory, and instructions about tracking tasks), so the model was actually processing far more than “how are you?”

- The other ~6.5 seconds remain outside the provider call, and the reason is unclear from the trace - I’m guessing it was Goose processing the response stream.

Out of curiosity, I ran the same prompt against a different free-tier model, `nvidia/nemotron-3.5-lightning:free`:

![Jaeger trace showing a 7.9-second Goose reply after switching to a different model.](https://cdn.sanity.io/images/4o10fa7h/production/5d3b9a29b100a8df8255950249374936ad9290a9-1920x941.png?w=1200)

This trace showed that the reply took 7.9 seconds. The model call itself dropped from ~7 seconds to ~1 second, but there were still ~7 unexplained seconds outside the model call, similar to the first trace.

Overall, tracing showed that about half of the original ~14-second wait was the model call, and swapping in a different free model cut that significantly, to ~1 second. The remaining ~7 seconds stayed about the same, which suggests it came from Goose itself rather than the model. Either way, without the trace, I would have assumed the model was responsible for the entire ~14 seconds; turns out that it was actually responsible for only about half.

NOTE: It’s worth mentioning that these are all single runs on exclusively free-tier models, so these numbers shouldn’t be taken as authoritative. Free-tier models are subject to rate limits and shared capacity, so response times can vary from run to run.

## **ClickHouse**

This tracing setup worked well but had one problem. By default, Jaeger’s container image uses an in-memory store for collected traces. As a result, trace data is ephemeral and is lost whenever the container restarts or stops. To save trace data for a longer period, it’s necessary to configure a persistent storage option.

Enter ClickHouse, one of Jaeger’s supported [storage backends](https://www.jaegertracing.io/docs/2.21/storage/clickhouse/). Here’s how I configured it to work with Jaeger.

I began by creating a common Docker network for the Jaeger and ClickHouse services:

I deployed the ClickHouse server on the jaegernet network using its container image: 

This command starts the ClickHouse server, exposing the ClickHouse web dashboard on host port 8123 and the server on host port 9000. It also sets the user credentials (`admin` / `guessme`) for accessing the dashboard and creates a database for Jaeger traces (`jaeger`).

NOTE: The `admin` / `guessme` credentials are illustrative and should not be used in production environments.


I created a Jaeger configuration file in `~/jaeger-config.yaml` with the following content:

This configures an OpenTelemetry collector to ingest trace data via standard OTLP endpoints (gRPC on port 4317 and HTTP on port 4318) and exports it directly to the ClickHouse database using Jaeger’s native storage extensions. It also configures Jaeger’s query extension to visualize and search persisted traces, and includes a health check for collector status.


Finally, I restarted Jaeger pointing it to the new network and configuration file:

I confirmed that both Jaeger and ClickHouse services were running:

## **Trace #2**

For a more realistic test, I [connected Goose to Cloudflare’s MCP server](https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/#connect-to-the-cloudflare-api-mcp-server) and asked it an account-specific question.

The [Cloudflare MCP server](https://github.com/cloudflare/mcp) uses [“code mode”](https://blog.cloudflare.com/code-mode-mcp/) and gives agents just two tools to work with, so this gave me a chance to observe how Goose used those tools to write code against the Cloudflare API and answer my questions.

Here’s a transcript of the Goose session:

Here’s the Jaeger trace for this session:

![Jaeger trace showing model and tool-call spans from a Goose session using the Cloudflare MCP server.](https://cdn.sanity.io/images/4o10fa7h/production/4b9dae8ff2aea9c7a5ef23440beeefaac0e2f593-1920x966.png?w=1200)

This trace shows that the reply took 48.9 seconds and produced 10 spans, alternating between model calls (`stream_response_from_provider`) and tool calls (`dispatch_tool_call`). The model decided to use the Cloudflare MCP extension, updated its todo list, wrote and executed code to query the API for active zones, and then generated the answer.

To test data persistence, I killed and restarted the containers, then checked the Jaeger dashboard again. The older trace was still there. Because both containers were started with `--rm`, stopping them deleted the containers; however, the traces were unaffected because ClickHouse was configured to save data in the `clickhouse_data` Docker volume.

To confirm the traces were really stored in ClickHouse and not just cached somewhere, I opened the ClickHouse web dashboard at http://localhost:8123/play and queried the `jaeger` database directly with SQL:

![ClickHouse SQL query results showing persisted Jaeger trace records in the jaeger database.](https://cdn.sanity.io/images/4o10fa7h/production/a728e68196201c4c2d96b80f731956abfa5f475c-1920x800.png?w=1200)

ClickHouse also includes a built-in monitoring dashboard, which is available at http://localhost:8123/dashboard. Here’s what it looks like:

![ClickHouse monitoring dashboard showing activity as Jaeger writes Goose trace data.](https://cdn.sanity.io/images/4o10fa7h/production/a96895bdfc8c65aa84f3c11e718afbb71ddb6fde-1920x800.png?w=1200)

Each Goose session shows up as a small burst of activity, with rows inserted as Jaeger writes to the `jaeger` database. This is a useful way to confirm that traces are flowing in real time.

## **Summary**

I started off trying to answer a simple question: why did a three-word greeting take 14 seconds to get a response?

From my experiments, it’s clear that when you ask a model a question, the reply looks like a single response but there’s actually a lot going on behind the scenes: the model call, the model’s reasoning steps, the agent’s response processing, the agent’s tool calls, and so on. The Cloudflare test took nearly 49 seconds, with several tool calls and task-list updates before the final answer. Turning on message capture let me read the actual conversation inside each span, including the details of each reasoning step and the extra context Goose added.

If you run AI agents locally, adding tracing is a great way to see why some queries might be slower than others, or to see if changing your prompts can produce faster or better results. If you’re using Goose, OpenTelemetry support is built in. Configure an OTLP endpoint to export telemetry, with message-content capture available separately if you need it.
