---
title: Correlating LLM Observability and APM
description: >-
  Learn how to navigate between LLM Observability spans and APM spans so you can
  gain insights into LLM-specific operations and your broader application
  ecosystem.
breadcrumbs: Docs > LLM Observability > Monitoring > Correlating LLM Observability and APM
---

# Correlating LLM Observability and APM

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

## Overview{% #overview %}

This guide explains how you can use both LLM Observability and APM to correlate LLM Observability and APM [spans](https://docs.datadoghq.com/llm_observability/terms/#spans) in Datadog.

By instrumenting your LLM-specific operations with LLM Observability and your broader application with APM, you can accomplish the following:

- Understand end-to-end visibility: Explore upstream and downstream requests of your LLM applications within the context of your entire application.
- From APM, dive deeper into LLM Observability: Investigate whether or not an issue with your application is specific to LLM-specific applications, such as a call to OpenAI.

## Setup{% #setup %}

The LLM Observability SDK is built on APM's dd-tracer. This allows you to use LLM Observability with [Application Performance Monitoring (APM)](https://docs.datadoghq.com/tracing)

If you are using the [LLM Observability SDK for Python](https://docs.datadoghq.com/llm_observability/setup/sdk/) along with APM's [`dd-tracer`](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/), you can navigate between spans in Datadog APM and LLM Observability without additional setup.

If you are using the [LLM Observability API](https://docs.datadoghq.com/llm_observability/setup/api/) with `dd-tracer` for APM:

1. Use the appropriate method to obtain the span ID from the tracer (for example, using `span.Context().SpanID()` for the Go tracer).
1. Include the captured span IDs in all of the LLM Observability API requests. This links APM and LLM Observability spans in Datadog.

## Navigate between spans{% #navigate-between-spans %}

By using this integration, you can correlate data across your application stack and understand how your LLM applications interact with other components. You can also resolve issues more quickly and optimize your application's performance.

{% video
   url="https://datadog-docs.imgix.net/images/llm_observability/guides/apm/end_to_end_tracing.mp4" /%}

### From LLM Observability to APM{% #from-llm-observability-to-apm %}

To understand the broader context of your LLM operations within your application ecosystem, select an LLM Observability span in the [LLM Observability Explorer](https://app.datadoghq.com/llm/traces) and click **APM span** to navigate to the relevant APM span.

{% image
   source="https://datadog-docs.imgix.net/images/llm_observability/guides/apm/llm_span.c236676d1fb54e8564cd3f30b2cc01ea.png?auto=format"
   alt="An LLM Observability span with a related APM span that you can navigate to from the Traces page in LLM Observability" /%}

### From APM to LLM Observability{% #from-apm-to-llm-observability %}

To access LLM-specific insights, select an APM span in the [Trace Explorer](https://app.datadoghq.com/apm/traces) and click **View Span** in the LLM Observability section on the **Info** tab to navigate to the corresponding LLM Observability span.

{% image
   source="https://datadog-docs.imgix.net/images/llm_observability/guides/apm/apm_span.f09c8128b4449158a04557fc1cd33919.png?auto=format"
   alt="An APM span with a related LLM Observability span that you can navigate to from the Traces page in APM" /%}

## Further Reading{% #further-reading %}

- [Learn about LLM Observability Spans](https://docs.datadoghq.com/llm_observability/terms/)
- [Learn about APM Spans](https://docs.datadoghq.com/glossary/#span/)
- [Troubleshooting RAG-based LLM applications](https://www.datadoghq.com/blog/troubleshooting-rag-llms/)
