@lark-apaas/miaoda-cli 0.1.2-alpha.00d0f18 → 0.1.2-alpha.08ca9fb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,7 @@ function registerLog(parent) {
45
45
  .argParser((0, shared_1.caseInsensitiveChoice)(["DEBUG", "INFO", "WARN", "ERROR"])))
46
46
  .option("--since <time>", "开始时间")
47
47
  .option("--until <time>", "截止时间")
48
+ .option("--log-id <id>", "按 log ID 过滤")
48
49
  .option("--trace-id <id>", "按 trace ID 过滤")
49
50
  .option("--grep <pattern>", "按关键字模糊搜索 body")
50
51
  .option("--module <name>", "按模块名过滤")
@@ -61,6 +62,7 @@ JSON 输出
61
62
 
62
63
  示例
63
64
  $ miaoda observability log --since 1h --level error --json
65
+ $ miaoda observability log --log-id log_abc123 --json
64
66
  $ miaoda observability log --trace-id 140ebb5ac9b... --json
65
67
  $ miaoda observability log --api /api/orders --min-duration 200 --json
66
68
  `);
@@ -72,6 +74,7 @@ JSON 输出
72
74
  level: rawOpts.level,
73
75
  since: rawOpts.since,
74
76
  until: rawOpts.until,
77
+ logId: rawOpts.logId,
75
78
  traceId: rawOpts.traceId,
76
79
  grep: rawOpts.grep,
77
80
  module: rawOpts.module,
@@ -45,12 +45,13 @@ async function handleObservabilityLog(opts) {
45
45
  const appEnv = "runtime";
46
46
  const limit = (0, helpers_1.validateLimit)(opts.limit ?? 50);
47
47
  // 过滤 key 对齐 BAM LogItem 字段名:
48
- // - 顶层字段:severityText / traceID(注意大小写)
48
+ // - 顶层字段:id / severityText / traceID(注意大小写)
49
49
  // - attributes 里的业务字段:module / user_id / page / api(snake_case,
50
50
  // 依据 BAM IDL 的 LogItem.attributes 描述:"包括 tenant_id, module, user_id, page, api 等")
51
51
  // - duration_ms 暂未在 BAM 描述里明确列出,留 TODO 等 e2e 验证
52
52
  const fieldFilters = (0, helpers_1.buildFieldFilters)([
53
53
  { key: "severity_text", value: opts.level ? (0, helpers_1.eqFilter)(opts.level) : undefined },
54
+ { key: "id", value: opts.logId ? (0, helpers_1.eqFilter)(opts.logId) : undefined },
54
55
  { key: "trace_id", value: opts.traceId ? (0, helpers_1.eqFilter)(opts.traceId) : undefined },
55
56
  { key: "module", value: opts.module ? (0, helpers_1.eqFilter)(opts.module) : undefined },
56
57
  { key: "user_id", value: opts.userId ? (0, helpers_1.eqFilter)(opts.userId, "i64") : undefined },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.2-alpha.00d0f18",
3
+ "version": "0.1.2-alpha.08ca9fb",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {