Skip to content

Commit 10504f8

Browse files
feat(observability): add Tencent Cloud CLS (AgentObs) integration via Langfuse SDK (#3165)
Co-authored-by: eileennchen <eileennchen@tencent.com>
1 parent 45adecd commit 10504f8

12 files changed

Lines changed: 2893 additions & 114 deletions

File tree

‎.env.example‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ LANGFUSE_PUBLIC_KEY=
5858
LANGFUSE_SECRET_KEY=
5959
LANGFUSE_BASE_URL=
6060

61+
# Tencent Cloud CLS / AgentObs observability (optional env-var fallback).
62+
# Prefer configuring in Dashboard → Settings → Advanced → Observability (supports
63+
# encrypted SecretId/SecretKey storage, auto-creating CLS apps via CreateAgentApplication,
64+
# or binding an existing Topic ID). Restart after changing env vars.
65+
# OCTOP_AGENTOBS_ENABLED=true
66+
# CLS_DEFAULT_REGION=ap-guangzhou
67+
# CLS_TOPIC_ID=
68+
# CLS_ACCESS_TYPE=Langfuse
69+
# TENCENTCLOUD_SECRET_ID=
70+
# TENCENTCLOUD_SECRET_KEY=
71+
# TENCENTCLOUD_TOKEN= # Optional, required only for STS credentials
72+
6173
# ---------------------------------------------------------------------------
6274
# Live integration tests (tests/live/*): REAL credentials.
6375
#

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
## [Unreleased]
1414

1515
### 新增
16+
- 可观测设置新增腾讯云 CLS(AgentObs)接入:支持填写腾讯云 SecretId / SecretKey 通过 Langfuse SDK(OTLP/HTTP Basic Auth)直接上报 Trace,支持自动调用 `CreateAgentApplication` 创建/复用 CLS 应用获取 Topic ID,也支持拉取或直接填写已有应用的 Topic ID,并提供内网接入点、内容脱敏及连通性校验。
1617
- 知识库设置新增「分块与检索」标签页,可配置分块大小、分块重叠、默认检索条数和上下文字符预算。
1718
- 用户管理支持创建限次邀请链接。链接在注册满员后自动停用,管理员也可以提前停用并查看已注册的用户。邀请管理 API 移除了 `used_at`、`used_by_user_id` 和 `revoked_at`,可通过注册记录和邀请状态查看使用情况。
1819
- 自托管可用环境变量放行内网出站目标:`OCTOP_SSRF_ALLOWLIST`(主机名、`.后缀` 或 CIDR)让语音服务、OAuth MCP 发现与令牌请求等指向内网服务,`OCTOP_SSRF_ALLOW_HTTP` 允许这些目标走 http;仍做 DNS 解析并固定连接 IP 防重绑定,不配置时行为不变(#2016)

‎dashboard/src/api/modules/observability.ts‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,64 @@ export interface LangfuseConfig {
88
configured: boolean;
99
}
1010

11+
export interface ClsTopicItem {
12+
topic_id: string;
13+
flag: string;
14+
}
15+
16+
export interface ClsApplicationItem {
17+
application_id: string;
18+
application_name: string;
19+
access_type: string;
20+
region: string;
21+
topic_id: string;
22+
logset_id: string;
23+
log_topics: ClsTopicItem[];
24+
created: boolean;
25+
}
26+
27+
export interface ClsConfig {
28+
enabled: boolean;
29+
region: string;
30+
topic_id: string;
31+
application_id: string;
32+
application_name: string;
33+
access_type: string;
34+
use_internal_endpoint: boolean;
35+
mask_content: boolean;
36+
secret_id_masked: string;
37+
secret_id_set: boolean;
38+
secret_key_set: boolean;
39+
configured: boolean;
40+
endpoint: string;
41+
active_backend: "cls" | "langfuse" | "cls_env" | "none" | string;
42+
application_created?: boolean;
43+
}
44+
45+
export interface ClsSavePayload {
46+
enabled: boolean;
47+
region: string;
48+
topic_id?: string;
49+
application_id?: string;
50+
application_name?: string;
51+
access_type?: string;
52+
use_internal_endpoint?: boolean;
53+
mask_content?: boolean;
54+
secret_id?: string | null;
55+
secret_key?: string | null;
56+
auto_create_app?: boolean;
57+
logset_id?: string | null;
58+
reuse_existing?: boolean;
59+
}
60+
61+
export interface ClsTestResult {
62+
ok: boolean;
63+
error?: string;
64+
api_ok?: boolean | null;
65+
otlp_ok?: boolean | null;
66+
endpoint?: string;
67+
}
68+
1169
export const observabilityApi = {
1270
getLangfuse: () => request<LangfuseConfig>("/admin/observability/langfuse"),
1371
saveLangfuse: (body: {
@@ -32,4 +90,49 @@ export const observabilityApi = {
3290
body: JSON.stringify(body ?? {}),
3391
},
3492
),
93+
94+
getCls: () => request<ClsConfig>("/admin/observability/cls"),
95+
saveCls: (body: ClsSavePayload) =>
96+
request<ClsConfig>("/admin/observability/cls", {
97+
method: "PUT",
98+
body: JSON.stringify(body),
99+
}),
100+
listClsApplications: (body?: {
101+
region?: string | null;
102+
access_type?: string | null;
103+
application_name?: string | null;
104+
secret_id?: string | null;
105+
secret_key?: string | null;
106+
}) =>
107+
request<{ applications: ClsApplicationItem[] }>(
108+
"/admin/observability/cls/applications/list",
109+
{
110+
method: "POST",
111+
body: JSON.stringify(body ?? {}),
112+
},
113+
),
114+
createClsApplication: (body: {
115+
region?: string | null;
116+
application_name: string;
117+
access_type?: string;
118+
logset_id?: string | null;
119+
reuse_existing?: boolean;
120+
secret_id?: string | null;
121+
secret_key?: string | null;
122+
}) =>
123+
request<ClsApplicationItem>("/admin/observability/cls/applications", {
124+
method: "POST",
125+
body: JSON.stringify(body),
126+
}),
127+
testCls: (body?: {
128+
region?: string | null;
129+
topic_id?: string | null;
130+
use_internal_endpoint?: boolean | null;
131+
secret_id?: string | null;
132+
secret_key?: string | null;
133+
}) =>
134+
request<ClsTestResult>("/admin/observability/cls/test", {
135+
method: "POST",
136+
body: JSON.stringify(body ?? {}),
137+
}),
35138
};

‎dashboard/src/locales/en.json‎

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3555,8 +3555,12 @@
35553555
"runtimeHint": "Running agents reload automatically after save. Tool approval uses HITL; command guard blocks risky shell parameters before tools run."
35563556
},
35573557
"observability": {
3558+
"title": "Observability",
3559+
"description": "Export conversation traces via Langfuse SDK to Langfuse or Tencent Cloud CLS (AgentObs).",
35583560
"loading": "Loading observability settings…",
35593561
"loadError": "Failed to load observability settings",
3562+
"activeTag": "Active",
3563+
"envFallbackBanner": "Deployment environment variables (OCTOP_AGENTOBS_ENABLED) are currently active for Tencent Cloud CLS. Enabling a backend below takes precedence.",
35603564
"langfuseTitle": "Langfuse",
35613565
"langfuseDesc": "Send conversation traces to Langfuse for monitoring, debugging, and cost analysis.",
35623566
"enable": "Enable Langfuse tracing",
@@ -3572,7 +3576,50 @@
35723576
"saveFailed": "Failed to save settings",
35733577
"testConnection": "Test connection",
35743578
"testSuccess": "Langfuse connection successful",
3575-
"testFailed": "Langfuse connection failed"
3579+
"testFailed": "Langfuse connection failed",
3580+
"clsTitle": "Tencent Cloud CLS",
3581+
"clsEnable": "Enable Tencent Cloud CLS tracing",
3582+
"clsHint": "Report Langfuse SDK traces directly to Tencent Cloud CLS AgentObs via OTLP/HTTP Basic Auth using your Tencent Cloud SecretId / SecretKey. Auto-create an application via CreateAgentApplication or bind an existing Topic ID.",
3583+
"clsRegion": "Tencent Cloud Region",
3584+
"clsRegionRequired": "Region is required (e.g. ap-guangzhou)",
3585+
"clsSecretId": "Tencent Cloud SecretId",
3586+
"clsSecretIdRequired": "SecretId is required",
3587+
"clsSecretIdSet": "SecretId saved ({{masked}}). Leave blank to keep it.",
3588+
"clsSecretKey": "Tencent Cloud SecretKey",
3589+
"clsSecretKeyRequired": "SecretKey is required",
3590+
"clsSecretKeySet": "SecretKey is already saved. Leave blank to keep it.",
3591+
"clsMode": "Application Mode",
3592+
"clsModeCreate": "Auto-create Application",
3593+
"clsModeExisting": "Existing Application / Topic ID",
3594+
"clsAppName": "Application Name (service.name)",
3595+
"clsAppNameRequired": "Application name is required",
3596+
"clsAppNameInvalid": "Must not contain '|' and max 64 characters",
3597+
"clsAccessType": "Access Type",
3598+
"clsAccessTypeLangfuse": "Langfuse (Recommended, native Langfuse SDK semantics)",
3599+
"clsAccessTypeAgent": "Agent (OpenTelemetry GenAI redacted metrics)",
3600+
"clsLogsetId": "Logset ID (optional)",
3601+
"clsLogsetIdPlaceholder": "Leave empty to let CLS assign a logset automatically",
3602+
"clsCreateApp": "Create / Bind CLS Application",
3603+
"clsAppCreated": "Created CLS application. Topic ID: {{topicId}}",
3604+
"clsAppReused": "Bound existing CLS application. Topic ID: {{topicId}}",
3605+
"clsCreateAppFailed": "Failed to create CLS application",
3606+
"clsFetchApps": "Load Existing Apps",
3607+
"clsFetchAppsFailed": "Failed to fetch CLS applications",
3608+
"clsNoAppsFound": "No CLS Agent applications found in this region. Switch to Auto-create or enter a Topic ID manually.",
3609+
"clsSelectExistingApp": "Select Existing CLS Application",
3610+
"clsSelectExistingPlaceholder": "Click 'Load Existing Apps' first",
3611+
"clsTopicId": "Trace Topic ID",
3612+
"clsTopicIdRequired": "Topic ID is required (enter manually or create an app first)",
3613+
"clsTopicIdExtra": "You can paste an existing CLS Trace Topic ID directly (works with cls:pushLog-only sub-account keys).",
3614+
"clsApplicationId": "Bound Application ID",
3615+
"clsEndpointPreview": "OTLP Endpoint",
3616+
"clsInternalEndpoint": "Use Tencent Cloud internal endpoint (cls.tencentyun.com)",
3617+
"clsMaskContent": "Mask conversation content (omit prompts and responses)",
3618+
"clsSaved": "Tencent Cloud CLS settings saved",
3619+
"clsSavedWithCreate": "Created CLS application and saved settings (Topic ID: {{topicId}})",
3620+
"clsTestSuccess": "Tencent Cloud CLS connection verified",
3621+
"clsTestSuccessPushOnly": "OTLP ingestion verified (management API not permitted for this key; existing Topic reporting works)",
3622+
"clsTestFailed": "Tencent Cloud CLS connection test failed"
35763623
},
35773624
"mediaGeneration": {
35783625
"title": "Image and video generation",

‎dashboard/src/locales/zh.json‎

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3555,8 +3555,12 @@
35553555
"runtimeHint": "保存后运行中的专家会自动重载。工具审批通过 HITL 实现;命令防护在参数层拦截危险 shell 指令。"
35563556
},
35573557
"observability": {
3558+
"title": "可观测追踪",
3559+
"description": "通过 Langfuse SDK 将对话链路与模型调用数据上报至 Langfuse 或腾讯云 CLS(Agent 可观测)。",
35583560
"loading": "加载可观测配置…",
35593561
"loadError": "加载可观测配置失败",
3562+
"activeTag": "当前生效",
3563+
"envFallbackBanner": "当前正在使用部署环境变量(OCTOP_AGENTOBS_ENABLED)上报至腾讯云 CLS;在下方启用并保存配置后将优先使用页面配置。",
35603564
"langfuseTitle": "Langfuse",
35613565
"langfuseDesc": "将对话追踪数据发送到 Langfuse,用于监控、调试与成本分析。",
35623566
"enable": "启用 Langfuse 追踪",
@@ -3572,7 +3576,50 @@
35723576
"testConnection": "测试连接",
35733577
"testSuccess": "Langfuse 连接成功",
35743578
"testFailed": "Langfuse 连接失败",
3575-
"saveFailed": "保存失败"
3579+
"saveFailed": "保存失败",
3580+
"clsTitle": "腾讯云 CLS",
3581+
"clsEnable": "启用腾讯云 CLS 追踪",
3582+
"clsHint": "使用你的腾讯云 SecretId / SecretKey 通过 Langfuse SDK(OTLP/HTTP Basic Auth)直接将 Trace 上报至腾讯云 CLS Agent 可观测。支持自动调用 CreateAgentApplication 创建应用获取 Topic ID,或直接填写已有应用的 Topic ID。",
3583+
"clsRegion": "腾讯云地域(Region)",
3584+
"clsRegionRequired": "请选择或填写地域(如 ap-guangzhou)",
3585+
"clsSecretId": "腾讯云 SecretId",
3586+
"clsSecretIdRequired": "请填写腾讯云 SecretId",
3587+
"clsSecretIdSet": "已保存 SecretId({{masked}}),留空则不修改。",
3588+
"clsSecretKey": "腾讯云 SecretKey",
3589+
"clsSecretKeyRequired": "请填写腾讯云 SecretKey",
3590+
"clsSecretKeySet": "已保存 SecretKey,留空则不修改。",
3591+
"clsMode": "应用配置方式",
3592+
"clsModeCreate": "自动创建应用",
3593+
"clsModeExisting": "使用已有应用 / Topic ID",
3594+
"clsAppName": "应用名称(service.name)",
3595+
"clsAppNameRequired": "请填写应用名称",
3596+
"clsAppNameInvalid": "应用名称不能包含 | 且不超过 64 字符",
3597+
"clsAccessType": "接入类型(AccessType)",
3598+
"clsAccessTypeLangfuse": "Langfuse(推荐,原生 Langfuse SDK 语义)",
3599+
"clsAccessTypeAgent": "Agent(OpenTelemetry GenAI 脱敏指标)",
3600+
"clsLogsetId": "日志集 ID(可选)",
3601+
"clsLogsetIdPlaceholder": "留空则由 CLS 自动分配日志集",
3602+
"clsCreateApp": "创建 / 绑定 CLS 应用",
3603+
"clsAppCreated": "已创建 CLS 应用并获取 Topic ID:{{topicId}}",
3604+
"clsAppReused": "已复用同名 CLS 应用,Topic ID:{{topicId}}",
3605+
"clsCreateAppFailed": "创建 CLS 应用失败",
3606+
"clsFetchApps": "拉取已有应用",
3607+
"clsFetchAppsFailed": "拉取 CLS 应用列表失败",
3608+
"clsNoAppsFound": "当前地域下未找到 CLS Agent 应用,可切换为“自动创建应用”或手动填写 Topic ID。",
3609+
"clsSelectExistingApp": "选择已有 CLS 应用",
3610+
"clsSelectExistingPlaceholder": "先点击“拉取已有应用”加载列表",
3611+
"clsTopicId": "Trace 日志主题 ID(Topic ID)",
3612+
"clsTopicIdRequired": "请填写 Topic ID,或先点击创建应用",
3613+
"clsTopicIdExtra": "支持直接粘贴控制台已有的 Trace Topic ID(仅具 cls:pushLog 权限的子账号也可用)。",
3614+
"clsApplicationId": "已绑定应用 ID",
3615+
"clsEndpointPreview": "上报地址",
3616+
"clsInternalEndpoint": "使用腾讯云内网接入点(cls.tencentyun.com)",
3617+
"clsMaskContent": "隐私脱敏(不上报用户输入与模型输出正文)",
3618+
"clsSaved": "腾讯云 CLS 可观测配置已保存并生效",
3619+
"clsSavedWithCreate": "已自动创建 CLS 应用并保存配置(Topic ID:{{topicId}})",
3620+
"clsTestSuccess": "腾讯云 CLS 连接与上报校验成功",
3621+
"clsTestSuccessPushOnly": "OTLP 上报通道校验成功(当前密钥无应用管理权限,仅支持已有 Topic 上报)",
3622+
"clsTestFailed": "腾讯云 CLS 连接校验失败"
35763623
},
35773624
"mediaGeneration": {
35783625
"title": "图片与视频生成",

0 commit comments

Comments
 (0)