---
title: Trace ClickHouse Loom with Langfuse
sidebarTitle: ClickHouse Loom
logo: /images/logos/clickhouse_icon.svg
description: Send ClickHouse Loom memory operation traces to Langfuse over OpenTelemetry and inspect retrieval latency, model calls, and token usage.
category: Integrations
---

# Trace ClickHouse Loom with Langfuse

Send Loom’s server traces to Langfuse over OpenTelemetry to see where a memory search spends time and inspect the model calls it makes.

> **What is ClickHouse Loom?** [ClickHouse Loom](https://github.com/ClickHouse/loom) is an open-source, self-hosted memory server that lets AI agents store and retrieve context across sessions.

> **What is Langfuse?** Langfuse is an open-source AI engineering platform for tracing, evaluating, and debugging agent applications. Use [Langfuse Cloud](/cloud) or [self-host Langfuse](/self-hosting).

**Start with Langfuse** [Sign up](/cloud)

## Set up tracing [#setup]

<Steps>

### Get project API keys

Create a Langfuse project and get its public and secret keys from the project settings. If you need a Loom server, set one up with the [Loom quickstart](https://clickhouse.github.io/loom/getting-started/quickstart/).

### Configure the Loom server

Set these environment variables on the Loom server. For the Docker Compose installer, edit `$HOME/.loom/.env`.

```bash
# Langfuse Cloud, EU region
LOOM_LANGFUSE_URL=https://cloud.langfuse.com
# US: https://us.cloud.langfuse.com
# Japan: https://jp.cloud.langfuse.com
# HIPAA: https://hipaa.cloud.langfuse.com
LOOM_LANGFUSE_ADMIN_TOKEN=pk-lf-...:sk-lf-...
```

For self-hosted Langfuse, use your instance’s base URL. Loom appends `/api/public/otel/v1/traces` and authenticates with the `public_key:secret_key` pair. OpenTelemetry must be enabled on Loom (`LOOM_OTEL_ENABLED=true`, the default).

Restart Loom with the new environment. For the Docker Compose installer, recreate the Loom service to load the updated `.env`.

```bash
docker compose --project-directory "$HOME/.loom" up -d --force-recreate loom
```

### Verify a trace in Langfuse

Run a memory search from your agent or with the [Loom HTTP quickstart](https://clickhouse.github.io/loom/getting-started/quickstart/#4-first-memory-over-http). Open **Tracing** in your Langfuse project and select the `memory.search` trace. Expand it to inspect retrieval spans and any embedding or generation calls made by Loom.

If the trace is missing, check the base URL, key pair, and `LOOM_OTEL_ENABLED`. Loom reports the local exporter state at `GET /v1/health?include=langfuse`.

</Steps>

## What Loom sends [#what-loom-sends]

Loom exports server operation spans and includes latency, token usage, and cost where available. [Model prompt and completion capture](https://clickhouse.github.io/loom/features/integrations/langfuse/#what-text-leaves-loom) defaults to off and can be configured per namespace.

Loom also posts [retrieval-quality scores](https://clickhouse.github.io/loom/features/integrations/langfuse/#scores) onto each search trace: `retrieval_confidence`, `top_similarity`, `abstained`, and `abstain_reason`. `code.ask` traces add `code_ask_cache_hit` and `code_ask_coverage`. To have an LLM judge write a `retrieval_relevance` score, set `LOOM_RETRIEVAL_JUDGE_SAMPLE_RATE` above `0` (default `0`). Each sampled search costs one extra model call.

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/integrations/memory/loom.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [OpenAPI spec](https://cloud.langfuse.com/generated/api/openapi.yml), or read the [API reference as Markdown](https://api.reference.langfuse.com/index.md), instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx @langfuse/cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
