Skip to content

本节仅适用于未在离线模式下运行的客户,并假设您使用的是自托管 LangSmith 实例,且版本为 0.9.0 或更高。早期版本的 LangSmith 不具备此功能。

自托管的 LangSmith 实例将所有信息存储在本地,绝不会将敏感信息发送到您的网络之外。目前,我们仅根据您订单中的授权,为计费目的跟踪平台使用情况。为了更好地远程支持我们的客户,我们确实需要允许出站连接到 https://beacon.langchain.com

未来,我们将引入支持诊断功能,以帮助我们确保 LangSmith 在您的环境中以最佳水平运行。

这将需要您的网络允许出站连接到 https://beacon.langchain.com。如果需要静态 IP 地址,请参考 IP 地址白名单部分

通常,我们发送到 Beacon 的数据可以分为以下几类:

  • 订阅指标

    • 订阅指标用于确定 LangSmith 的访问级别和使用情况。这包括但不限于:
      • 追踪数量
      • 合同分配的席位数
      • 当前使用的席位数
  • 操作元数据

    • 此元数据将包含并收集上述订阅指标,以协助远程支持,使 LangChain 团队能够更有效、更主动地诊断和解决性能问题。

LangSmith 遥测

自版本 0.11 起,LangSmith 部署默认会将遥测数据发送回我们的后端。所有遥测数据都与组织和部署相关联,但绝不会与个人用户身份关联。我们不以任何形式收集 PII(个人身份信息)。

用途

  • 为自托管实例提供更主动的支持和更快速的故障排除。
  • 协助性能调优。
  • 了解实际使用情况以确定改进优先级。

收集内容

  • 请求元数据:匿名的请求计数、大小和持续时间。
  • 数据库指标:查询持续时间、错误率和性能计数器。
  • LangSmith 操作追踪:针对高延迟或失败请求的、包含时间和错误信息的追踪。这些不是客户追踪,而是关于 LangSmith 实例运行状况的操作追踪。

我们不收集实际的有效载荷内容、数据库记录或任何可以识别您的最终用户或客户的数据。

如何禁用

在您的 langsmith_config.yaml 文件中设置以下值:

yaml
config:
  telemetry:
    metrics: false
    traces: false

示例负载

为了最大限度地提高透明度,我们在此提供示例负载:

许可证验证

端点:

POST beacon.langchain.com/v1/beacon/verify

请求:

json
{
  "license": "<YOUR_LICENSE_KEY>"
}

响应:

json
{
  "token": "Valid JWT" // 短期有效的 JWT 令牌,用于避免重复的许可证检查
}

使用情况报告

端点:

POST beacon.langchain.com/v1/beacon/ingest-traces

请求:

json
{
  "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
{
  "inserted_count": 1 // 成功摄取的事务数量
}

遥测:LangSmith 操作指标

端点:

POST beacon.langchain.com/v1/beacon/v1/metrics

请求:

json
{
  "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
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}

遥测:LangSmith 操作追踪

端点:

POST beacon.langchain.com/v1/beacon/v1/traces

请求:

json
{
  "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": {}
            }
          ]
        }
      ]
    }
  ]
}

我们的承诺

LangChain 不会在订阅指标或操作元数据中存储任何敏感信息。收集的任何数据都不会与第三方共享。如果您对发送的数据有任何疑虑,请联系您的客户团队。

LangChain 中文文档