> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate with Alibaba Cloud Monitor

> Send traces from Dify applications to Alibaba Cloud Monitor (ARMS) via OpenTelemetry

## What is Alibaba Cloud Monitor

Alibaba Cloud provides a fully managed, maintenance-free observability platform that enables one-click monitoring, tracing, and evaluation of Dify applications.

> [!NOTE]
>
> Alibaba Cloud Monitor natively supports Python/Golang/Java applications through [LoongSuite](https://github.com/alibaba/loongsuite-python-agent) agents and open-source OpenTelemetry agents. In addition to one-click monitoring of Dify LLM applications, it also supports end-to-end observability of Dify components and their upstream and downstream dependencies through non-invasive agents.
>
> For more details, please refer to the [Cloud Monitor documentation](https://www.alibabacloud.com/help/en/cms/cloudmonitor-1-0/product-overview/what-is-cloudmonitor?spm=a3c0i.63551.2277339270.1.76c7112eeKEvSr).

## How to Configure Alibaba Cloud Monitor

### 1. Get Alibaba Cloud Endpoint and License Key

1. Log in to the [ARMS console](https://account.alibabacloud.com/login/login.htm?spm=5176.12901015-2.0.0.68d74b84XRatpU), and click **Integration Center** in the left navigation bar.
2. In the **Server-side Applications** area, click the **OpenTelemetry** card.
3. In the **OpenTelemetry** panel that appears, select **HTTP** as the export protocol, and select the connection method and region according to your actual deployment.

![Get Alibaba Cloud Access Point](https://dify-public-resources.oss-cn-hangzhou.aliyuncs.com/dify-doc/get_endpoint.png)

4. Save the **Public Endpoint** and **Authentication Token (License Key)**.

> [!NOTE]
>
> Use the HTTP(S) base URL as **Endpoint**, keeping the port if the HTTP collector requires one. Enter the token separately as **License Key**. Do not include `adapt_<key>` or the ingestion path, and do not use the gRPC port `8090`; Dify constructs the OTLP/HTTP ingestion URL.

### 2. Configure Cloud Monitor in Dify

> [!NOTE]
>
> Requires Dify v1.6.0 or later.

1. Log in to the Dify console and navigate to the application you want to monitor.
2. Open **Monitoring** in the left navigation bar.
3. Click **Tracing app performance**, then click **Configure** in the **Cloud Monitor** area.

![Configure Alibaba Cloud Monitor](https://dify-public-resources.oss-cn-hangzhou.aliyuncs.com/dify-doc/config_cms.png)

4. In the dialog that appears, enter the **License Key** and **Endpoint** obtained in step 1, and customize the **App Name** (the application name displayed in the ARMS console), then click **Save & Enable**.

## View Monitoring Data in Alibaba Cloud Monitor

After configuration, debug or production data from applications in Dify can be monitored in Cloud Monitor.

### Method 1: Jump to ARMS Console from Dify Application

In the Dify console, select an application with tracing enabled, go to **Tracing Configuration**, and click **View** in the **Cloud Monitor** area.

### Method 2: View Directly in ARMS Console

Go to the corresponding Dify application in the **LLM Application Monitoring > Application List** page of the ARMS console.

## Access More Data

Cloud Monitor provides multi-language non-invasive agents that support accessing various components of the Dify cluster to achieve end-to-end tracing.

| Dify Component | Agent | Details |
| - | - | - |
| Nginx | OpenTelemetry Agent | [Use OpenTelemetry for Nginx Tracing](https://www.alibabacloud.com/help/en/opentelemetry/user-guide/use-opentelemetry-to-perform-tracing-analysis-on-nginx?spm=a2c63.l28256.help-menu-search-90275.d_1) |
| API | LoongSuite-Python Agent | [loongsuite-python-agent](https://github.com/alibaba/loongsuite-python-agent/blob/main/README.md) |
| Sandbox | LoongSuite-Go Agent | [loongsuite-go-agent](https://github.com/alibaba/loongsuite-go-agent/blob/main/README.md) |
| Worker | OpenTelemetry Agent | [Submit Python Application Data via OpenTelemetry](https://www.alibabacloud.com/help/en/opentelemetry/user-guide/use-managed-service-for-opentelemetry-to-submit-the-trace-data-of-python-applications?spm=a2c63.p38356.help-menu-90275.d_2_0_5_0.18ee53a4EGoGuS) |
| Plugin-Daemon | LoongSuite-Go Agent | [loongsuite-go-agent](https://github.com/alibaba/loongsuite-go-agent/blob/main/README.md) |

> [!NOTE]
>
> After saving and enabling tracing, run the app again and check for a new trace in the monitoring service. Delivery is asynchronous; saving the configuration alone does not confirm that a trace has arrived.
>
> With both deployment switches off, the new Agent app type and workflows using the [new Agent node](https://enterprise-docs.dify.ai/en/3.14.x/use/nodes/agent.md#new-agent) still send ordinary traces, including available inputs and outputs, but omit the Agent's internal model and tool calls.
>
> To collect those calls, ask your deployment administrator to turn on both deployment switches in the Helm values: `OPS_AGENT_TRACE_ENABLED` and `DIFY_AGENT_APPLICATION_TRACING_ENABLED`. See [LLMOps Trace Delivery](https://enterprise-docs.dify.ai/en/3.14.x/deploy/advanced-configuration/environment-variables.md#llmops-trace-delivery) for details.
>
> Once both deployment switches are on, **Capture content** is off by default for these apps: inputs, outputs, and most metadata are removed, and error text is redacted across the whole workflow. Enable it to send that content. Legacy Agent apps and workflows using only classic Agent nodes retain ordinary tracing.

## Monitoring Data List

The tables below describe ordinary traces. When both deployment switches are on, traces from the new Agent app type and from workflows containing a new Agent node use a new UUIDv7 trace ID, with source and tracing-run IDs retained as `dify.source.id` and `dify.tracing.run_id` attributes. For the new Agent app type, spans named `Agent attempt 1`, `Agent attempt 2`, and so on, with the internal model and tool calls, replace the ordinary `llm` span when **Capture Agent internals** is on. These traces leave out the separate moderation, suggested-question, and naming records.

Dify exports a hierarchy of operations: a message contains an `llm` call, and a Chatflow message contains its workflow and node operations. Native token usage is reported on model calls only.

The detail lists below describe Dify's source records and metadata. Only the relevant, available values are exported; the raw records are not sent in full.

Cloud Monitor supports collecting data from Dify's Workflow/Chatflow/Chat/Agent applications, including execution details of workflows and workflow nodes, covering model calls, tool calls, knowledge retrieval, execution details of various process nodes, as well as metadata such as conversations and user information.

### Workflow/Chatflow Trace Information

<table>
  <thead>
    <tr>
      <th>Workflow</th>
      <th>Alibaba Cloud Monitor Trace</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>workflow\_id</td>
      <td>Unique identifier of the Workflow</td>
    </tr>

    <tr>
      <td>conversation\_id</td>
      <td>Conversation ID</td>
    </tr>

    <tr>
      <td>workflow\_run\_id</td>
      <td>ID of this run</td>
    </tr>

    <tr>
      <td>tenant\_id</td>
      <td>Tenant ID</td>
    </tr>

    <tr>
      <td>elapsed\_time</td>
      <td>Duration of this run</td>
    </tr>

    <tr>
      <td>status</td>
      <td>Run status</td>
    </tr>

    <tr>
      <td>version</td>
      <td>Workflow version</td>
    </tr>

    <tr>
      <td>total\_tokens</td>
      <td>Total tokens used in this run</td>
    </tr>

    <tr>
      <td>file\_list</td>
      <td>List of processed files</td>
    </tr>

    <tr>
      <td>triggered\_from</td>
      <td>Source that triggered this run</td>
    </tr>

    <tr>
      <td>workflow\_run\_inputs</td>
      <td>Input data for this run</td>
    </tr>

    <tr>
      <td>workflow\_run\_outputs</td>
      <td>Output data for this run</td>
    </tr>

    <tr>
      <td>error</td>
      <td>Errors that occurred during this run</td>
    </tr>

    <tr>
      <td>query</td>
      <td>Query used during runtime</td>
    </tr>

    <tr>
      <td>workflow\_app\_log\_id</td>
      <td>Workflow application log ID</td>
    </tr>

    <tr>
      <td>message\_id</td>
      <td>Associated message ID</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>Run start time</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>Run end time</td>
    </tr>
  </tbody>
</table>

**Workflow Trace Metadata**

* workflow\_id - Unique identifier of the Workflow
* conversation\_id - Conversation ID
* workflow\_run\_id - ID of this run
* tenant\_id - Tenant ID
* elapsed\_time - Duration of this run
* status - Run status
* version - Workflow version
* total\_tokens - Total tokens used in this run
* file\_list - List of processed files
* triggered\_from - Trigger source

### Message Trace Information

<table>
  <thead>
    <tr>
      <th>Message</th>
      <th>Alibaba Cloud Monitor Trace</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>message\_id</td>
      <td>Message ID</td>
    </tr>

    <tr>
      <td>message\_data</td>
      <td>Message data</td>
    </tr>

    <tr>
      <td>end\_user\_session\_id</td>
      <td>User's session\_id</td>
    </tr>

    <tr>
      <td>conversation\_model</td>
      <td>Conversation model</td>
    </tr>

    <tr>
      <td>message\_tokens</td>
      <td>Number of tokens in the message</td>
    </tr>

    <tr>
      <td>answer\_tokens</td>
      <td>Number of tokens in the answer</td>
    </tr>

    <tr>
      <td>total\_tokens</td>
      <td>Total tokens in message and answer</td>
    </tr>

    <tr>
      <td>error</td>
      <td>Error information</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>Input data</td>
    </tr>

    <tr>
      <td>outputs</td>
      <td>Output data</td>
    </tr>

    <tr>
      <td>file\_list</td>
      <td>List of processed files</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>Start time</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>End time</td>
    </tr>

    <tr>
      <td>conversation\_mode</td>
      <td>Conversation mode</td>
    </tr>
  </tbody>
</table>

**Message Trace Metadata**

* conversation\_id - ID of the conversation to which the message belongs
* ls\_provider - Model provider
* ls\_model\_name - Model ID
* status - Message status
* from\_end\_user\_id - ID of the sending user
* from\_account\_id - ID of the sending account
* agent\_based - Whether it is agent-based
* workflow\_run\_id - Workflow run ID
* from\_source - Message source
* message\_id - Message ID

### Dataset Retrieval Trace Information

<table>
  <thead>
    <tr>
      <th>Dataset Retrieval</th>
      <th>Alibaba Cloud Monitor Trace</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>message\_id</td>
      <td>Message ID</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>Input content</td>
    </tr>

    <tr>
      <td>documents</td>
      <td>Document data</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>Start time</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>End time</td>
    </tr>

    <tr>
      <td>message\_data</td>
      <td>Message data</td>
    </tr>
  </tbody>
</table>

**Dataset Retrieval Trace Metadata**

* message\_id - Message ID
* ls\_provider - Model provider
* ls\_model\_name - Model ID
* status - Message status
* from\_end\_user\_id - ID of the sending user
* from\_account\_id - ID of the sending account
* agent\_based - Whether it is agent-based
* workflow\_run\_id - Workflow run ID
* from\_source - Message source

### Tool Trace Information

<table>
  <thead>
    <tr>
      <th>Tool</th>
      <th>Alibaba Cloud Monitor Trace</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>message\_id</td>
      <td>Message ID</td>
    </tr>

    <tr>
      <td>tool\_name</td>
      <td>Tool name</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>Start time</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>End time</td>
    </tr>

    <tr>
      <td>tool\_inputs</td>
      <td>Tool inputs</td>
    </tr>

    <tr>
      <td>tool\_outputs</td>
      <td>Tool outputs</td>
    </tr>

    <tr>
      <td>message\_data</td>
      <td>Message data</td>
    </tr>

    <tr>
      <td>error</td>
      <td>Error information (if any)</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>Input content of the message</td>
    </tr>

    <tr>
      <td>outputs</td>
      <td>Answer content of the message</td>
    </tr>

    <tr>
      <td>tool\_config</td>
      <td>Tool configuration</td>
    </tr>

    <tr>
      <td>time\_cost</td>
      <td>Time cost</td>
    </tr>

    <tr>
      <td>tool\_parameters</td>
      <td>Tool parameters</td>
    </tr>

    <tr>
      <td>file\_url</td>
      <td>URL of associated file</td>
    </tr>
  </tbody>
</table>

**Tool Trace Metadata**

* message\_id - Message ID
* tool\_name - Tool name
* tool\_inputs - Tool inputs
* tool\_outputs - Tool outputs
* tool\_config - Tool configuration
* time\_cost - Time cost
* error - Error information
* tool\_parameters - Tool parameters
* message\_file\_id - Message file ID
* created\_by\_role - Creator role
* created\_user\_id - Creator user ID


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.