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

# 计费与运维遥测的出站配置

<Info>
  本页面仅适用于非离线（物理隔离）模式下的客户，并假设您使用的是自托管 LangSmith 实例，且版本为 0.9.0 或更高。
</Info>

自托管的 LangSmith 实例将所有信息存储在本地，绝不会将敏感信息发送到您的网络之外。但是，除非您在离线模式下运行，否则 LangSmith 需要出站连接到 `https://beacon.langchain.com` 以用于以下目的：

* **计费遥测** — 许可证验证和订阅/使用量报告（必需）
* **运维遥测** — 用于支持诊断的日志、指标和追踪（可选，可禁用）
* **使用情况遥测** — 用于产品洞察的匿名化使用快照（可选，可禁用）

<Warning>
  **必须允许出站连接到 `https://beacon.langchain.com`。** 如果需要，请参考[IP地址白名单部分](/langsmith/cloud#allowlisting-ip-addresses)了解静态IP地址。
</Warning>

## 计费遥测

对于未在离线模式下运行的自托管 LangSmith 实例，计费遥测是**必需的**。这包括许可证验证和订阅/使用量报告。

<Info>
  计费遥测**无法禁用**。如果您需要在没有任何出站连接的情况下运行，请联系您的客户团队获取离线（物理隔离）许可证。
</Info>

### 功能说明

* **许可证验证**：在启动时及之后定期验证您的 LangSmith 许可证密钥。
* **订阅/使用量报告**：根据您订单中的授权，报告平台使用指标以用于计费目的。

### 收集内容

* 许可证密钥验证请求
* 聚合使用量计数（追踪数量、分配的席位、使用中的席位）
* 组织和工作区标识符

### 示例载荷

#### 许可证验证

**端点：** `POST beacon.langchain.com/v1/beacon/verify`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "license": "<YOUR_LICENSE_KEY>"
}
```

**响应：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "token": "Valid JWT" // 短期有效的 JWT 令牌，以避免重复的许可证检查
}
```

#### 订阅/使用量报告

**端点：** `POST beacon.langchain.com/v1/beacon/ingest-traces`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "license": "<YOUR_LICENSE_KEY>",
  "trace_transactions": [
    {
      "id": "af28dfea-5358-463d-a2dc-37df1da72498",
      "tenant_id": "3a1c2b6f-4430-4b92-8a5b-79b8b567bbc1",
      "session_id": "b26ae531-cdb3-42a5-8bcf-05355199fe27",
      "trace_count": 5,
      "start_insertion_time": "2025-01-06T10:00:00Z",
      "end_insertion_time": "2025-01-06T11:00:00Z",
      "start_interval_time": "2025-01-06T09:00:00Z",
      "end_interval_time": "2025-01-06T10:00:00Z",
      "status": "completed",
      "num_failed_send_attempts": 0,
      "transaction_type": "type1",
      "organization_id": "c5b5f53a-4716-4326-8967-d4f7f7799735"
    }
  ]
}
```

**响应：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "inserted_count": 1 // 成功摄取的事务数量
}
```

## 运维遥测

自 **0.11** 版本起，LangSmith 部署默认发送运维遥测数据。此遥测数据有助于 LangChain 团队为自托管实例提供主动支持和更快速的故障排除。

<Info>
  运维遥测**独立于**计费遥测。您可以在计费遥测保持活动状态的同时禁用运维遥测。
</Info>

### 功能说明

* 实现对自托管实例的主动支持和更快速的故障排除
* 协助进行性能调优
* 根据实际使用模式帮助确定改进优先级

### 收集内容

* **请求元数据**：匿名化的请求计数、大小和持续时间
* **数据库指标**：查询持续时间、错误率和性能计数器
* **运维追踪**：高延迟或失败请求的时序和错误信息（这些**不是**客户追踪——它们是关于 LangSmith 实例自身运行的追踪）
* **日志消息**：仅警告和错误级别的日志消息

<Info>
  我们不收集实际的载荷内容、数据库记录或任何可以识别您的最终用户或客户的数据。所有遥测数据都与组织和部署相关联，但绝不会与个人用户关联。我们**不收集任何形式的 PII**（个人身份信息）。
</Info>

### 如何禁用

您可以通过在 `langsmith_config.yaml` 文件中设置以下值来禁用运维遥测：

```yaml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
config:
  telemetry:
    logs: false
    metrics: false
    traces: false
```

您也可以通过仅将特定值设置为 `false` 来禁用个别遥测类型。

<Warning>
  禁用运维遥测将停止导出本节中描述的日志、指标和追踪。它**不会**禁用计费遥测（许可证验证和订阅/使用量报告）。
</Warning>

### 示例载荷

#### 运维指标

**端点：** `POST beacon.langchain.com/v1/beacon/v1/metrics`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "resourceMetrics": [
    {
      "resource": {
        "attributes": [
          {
            "key": "resource.name",
            "value": { "stringValue": "langsmith-metrics" }
          },
          {
            "key": "env",
            "value": { "stringValue": "ls_self_hosted" }
          }
        ]
      },
      "scopeMetrics": [
        {
          "scope": {
            "name": "langsmith.metrics",
            "version": "0.1.0"
          },
          "metrics": [
            {
              "name": "langsmith_http_requests_latency",
              "unit": "seconds",
              "description": "Request latency of LangSmith services",
              "gauge": {
                "dataPoints": [
                  {
                    "asDouble": 12.34,
                    "startTimeUnixNano": 1678886400000000000,
                    "timeUnixNano": 1678886400000000000,
                    "attributes": [
                      {
                        "key": "endpoint",
                        "value": { "stringValue": "/sessions" }
                      },
                      { "key": "method", "value": { "stringValue": "GET" } },
                      {
                        "key": "service_name",
                        "value": { "stringValue": "langsmith_backend" }
                      }
                    ]
                  }
                ]
              }
            },
            {
              "name": "langsmith_http_requests_failed",
              "unit": "1",
              "description": "Counter of failed requests for LangSmith services",
              "sum": {
                "dataPoints": [
                  {
                    "asInt": 456,
                    "startTimeUnixNano": 1678886400000000000,
                    "timeUnixNano": 1678886400000000000,
                    "attributes": [
                      {
                        "key": "endpoint",
                        "value": { "stringValue": "/info" }
                      },
                      { "key": "method", "value": { "stringValue": "POST" } },
                      {
                        "key": "service_name",
                        "value": { "stringValue": "langsmith_platform_backend" }
                      }
                    ],
                    "aggregationTemporality": 2,
                    "isMonotonic": true
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}
```

#### 运维追踪

**端点：** `POST beacon.langchain.com/v1/beacon/v1/traces`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "resourceSpans": [
    {
      "resource": {
        "attributes": [
          {
            "key": "env",
            "value": {
              "stringValue": "ls_self_hosted"
            }
          },
          {
            "key": "service.name",
            "value": {
              "stringValue": "langsmith_backend"
            }
          }
        ]
      },
      "scopeSpans": [
        {
          "scope": {},
          "spans": [
            {
              "traceId": "71699b6fe85982c7c8995ea3d9c95df2",
              "spanId": "3c191d03fa8be0",
              "parentSpanId": "",
              "name": "receive_request",
              "startTimeUnixNano": "1581452772000000321",
              "endTimeUnixNano": "1581452773000000789",
              "droppedAttributesCount": 1,
              "events": [
                {
                  "timeUnixNano": "1581452773000000123",
                  "name": "parse_request",
                  "attributes": [
                    {
                      "key": "request_size",
                      "value": {
                        "stringValue": "100"
                      }
                    }
                  ],
                  "droppedAttributesCount": 2
                },
                {
                  "timeUnixNano": "1581452773000000123",
                  "name": "event",
                  "droppedAttributesCount": 2
                }
              ],
              "droppedEventsCount": 1,
              "status": {
                "message": "status-cancelled",
                "code": 2
              }
            },
            {
              "traceId": "71699b6fe85982c7c8995ea3d9c95df2",
              "spanId": "0932ksdka12345",
              "parentSpanId": "3c191d03fa8be0",
              "name": "process_request",
              "startTimeUnixNano": "1581452772000000321",
              "endTimeUnixNano": "1581452773000000789",
              "links": [],
              "droppedLinksCount": 3,
              "status": {}
            }
          ]
        }
      ]
    }
  ]
}
```

#### 运维日志消息

我们仅从自托管 LangSmith 实例导出错误日志消息。这使得 LangChain 团队能够排查应用程序错误，而无需与您的团队进行反复沟通。

**端点：** `POST beacon.langchain.com/v1/beacon/v1/logs`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "resourceLogs": [
    {
      "resource": {
        "attributes": [
          {
            "key": "service.name",
            "value": {
              "stringValue": "langsmith_backend"
            }
          }
        ]
      },
      "scopeLogs": [
        {
          "scope": {},
          "logRecords": [
            {
              "timeUnixNano": "1581452773000009875",
              "severityNumber": 13,
              "severityText": "Warning",
              "body": {
                "stringValue": "Database connection pool approaching capacity"
              },
              "attributes": [
                {
                  "key": "component",
                  "value": {
                    "stringValue": "langsmith_backend"
                  }
                },
                {
                  "key": "pool_size",
                  "value": {
                    "intValue": "95"
                  }
                }
              ],
              "droppedAttributesCount": 0,
              "traceId": "08040201000000000000000000000000",
              "spanId": "0102040800000000"
            },
            {
              "timeUnixNano": "1581452773000000789",
              "severityNumber": 17,
              "severityText": "Error",
              "body": {
                "stringValue": "Failed to process trace batch"
              },
              "attributes": [
                {
                  "key": "component",
                  "value": {
                    "stringValue": "langsmith_queue_worker"
                  }
                },
                {
                  "key": "error_type",
                  "value": {
                    "stringValue": "timeout"
                  }
                }
              ],
              "droppedAttributesCount": 0,
              "traceId": "",
              "spanId": ""
            }
          ]
        }
      ]
    }
  ]
}
```

## 使用情况遥测

使用情况遥测收集您的 LangSmith 实例使用指标的匿名化快照。这些数据有助于 LangChain 了解平台采用模式并为产品开发决策提供信息。

<Info>
  使用情况遥测是**可选的**，可以禁用。与计费遥测不同，您可以完全控制是否将这些快照发送给 LangChain。
</Info>

### 功能说明

* 定期捕获聚合的使用指标
* 提供关于功能采用和平台增长的洞察
* 帮助 LangChain 根据实际使用情况确定改进和新功能的优先级

### 收集内容

* **平台指标**：工作区、项目、实验、数据集、评估器和其他平台资源的数量
* **功能使用情况**：运行规则、标注队列、提示词和提示词相关活动的数量
* **活跃用户**：过去 30 天内活跃的 PAT（个人访问令牌）数量
* **时间戳**：快照的时间范围（UTC 的起止时间戳）

<Info>
  所有指标**仅为聚合计数**。不收集任何单个资源数据、标识符或使用模式。我们不收集任何可以识别您的最终用户或客户的信息。
</Info>

### 示例载荷

**端点：** `POST /v1/beacon/usage-snapshot`

**请求：**

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "license_key": "<YOUR_LICENSE_KEY>",
  "from_timestamp": "2026-03-25T02:00:00+00:00",
  "to_timestamp": "2026-03-26T02:00:00+00:00",
  "measures": {
    "workspaces": 12,
    "projects": 87,
    "experiments": 34,
    "datasets": 15,
    "evaluators": 8,
    "run_rules": 5,
    "annotation_queues": 3,
    "prompts": 22,
    "prompt_commits": 156,
    "prompt_pulls": 1043,
    "active_pats_30d": 47
  }
}
```

### 如何禁用

您可以通过在部署配置中设置以下环境变量来禁用使用情况遥测：

```yaml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
PHONE_HOME_USAGE_REPORTING_ENABLED: false
```

将此添加到您的 Helm 配置的 `commonEnv` 部分，以永久禁用使用情况遥测报告。

<Warning>
  禁用使用情况遥测**不会**影响计费或运维遥测。许可证验证和订阅/使用量报告将继续正常运行。
</Warning>

## 我们的承诺

LangChain 不会在计费或运维遥测中存储任何敏感信息。收集的任何数据都不会与第三方共享。日志消息经过过滤，仅包含错误严重级别，我们不会捕获可能包含敏感应用程序数据的日志消息。如果您对发送的数据有任何疑虑，请禁用遥测和/或联系您的客户团队。

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\langsmith\self-host-egress.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
