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

# 查看整个组织的追踪计数

<Note>
  此功能在 Helm chart 版本 0.9.5 及更高版本中可用。
</Note>

LangSmith 会为自托管安装自动生成并同步组织使用情况图表。

这些图表可在 `设置 > 使用情况和计费 > 使用情况图表` 下找到：

* 按工作区统计使用情况：此图表按工作区统计追踪（根运行）数量
* 组织使用情况：此图表统计组织的所有追踪（根运行）数量

图表每 5 分钟刷新一次，以包含任何新的工作区。请注意，这些图表不可编辑。

## 以编程方式获取追踪计数

您可以使用两种不同的方法以编程方式检索追踪计数：

### 方法 1：使用 LangSmith REST API

如果您的自托管安装使用在线密钥，您可以使用 [LangSmith REST API](https://api.smith.langchain.com/redoc?_gl=1*w68t81*_gcl_au*MTgyNTQ5MDUxNy4xNzU2NzI3MDky*_ga*MTU3NDY5MzQyNC4xNzQyOTMyMTQ2*_ga_47WX3HKKY2*czE3NTgyMDAxMDAkbzM0MSRnMCR0MTc1ODIwMDEwMCRqNjAkbDAkaDA.#tag/orgs/operation/get_org_usage_api_v1_orgs_current_billing_usage_get) 来获取组织使用情况数据。

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
curl -X GET "https://your-langsmith-instance.com/api/v1/orgs/current/billing/usage" \
  -H "Accept: application/json" \
  -H "X-API-Key: your-api-key" \
  -G \
  -d "starting_on=2025-09-01T00:00:00Z" \
  -d "ending_before=2025-10-01T00:00:00Z" \
  -d "on_current_plan=true"
```

### 方法 2：使用 PostgreSQL 支持查询

对于使用离线密钥的安装，或者当您需要更详细的导出功能时，您可以直接对 PostgreSQL 数据库运行支持查询。所有可用的脚本都在 [支持查询仓库](https://github.com/langchain-ai/helm/tree/main/charts/langsmith/scripts/support_queries/postgres) 中。

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
sh run_support_query_pg.sh "postgres://postgres:postgres@localhost:5432/postgres" \
  --input support_queries/pg_get_trace_counts_daily.sql \
  --output trace_counts.csv
```

有关运行支持查询的更多详细信息，请参阅 [对 PostgreSQL 运行支持查询](/langsmith/script-running-pg-support-queries) 指南。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档](/use-these-docs) 通过 MCP 连接到 Claude、VSCode 等，以获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/langsmith/self-host-organization-charts.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
