bfi-cli 0.1.67 → 0.1.69

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +19 -12
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -8333,14 +8333,14 @@ async function runYmc(args, globalOpts) {
8333
8333
  ...requireEnv(rest),
8334
8334
  ...timeOpts(rest),
8335
8335
  page: Number(opt(rest, "--page") || 1),
8336
- pageSize: Number(opt(rest, "--page-size") || 20)
8336
+ pageSize: Number(opt(rest, "--page-size") || 20),
8337
+ enableProfiler: flag(rest, "--no-profiler") ? "false" : "true"
8337
8338
  };
8338
8339
  for (const [k, name] of [
8339
8340
  ["sqlStr", "--sql-str"],
8340
8341
  ["md5Sql", "--md5"],
8341
8342
  ["traceId", "--trace-id"],
8342
- ["curAppCode", "--app"],
8343
- ["enableProfiler", "--profiler"]
8343
+ ["curAppCode", "--app"]
8344
8344
  ]) {
8345
8345
  const v = opt(rest, name);
8346
8346
  if (v) body[k] = v;
@@ -8378,6 +8378,7 @@ async function runYmc(args, globalOpts) {
8378
8378
  }
8379
8379
  const cost = opt(rest, "--min-cost");
8380
8380
  if (cost) body.costTime = [Number(cost), 999999];
8381
+ if (flag(rest, "--profiler")) console.error("⚠️ --profiler 是上游采样过滤器,实测常返回空集——常规取证请去掉(CPU 热点走 dump-list)");
8381
8382
  emit(await api.call("ymc/warningCall", body), jsonMode, (data) => {
8382
8383
  const d = data;
8383
8384
  const rows = Array.isArray(d) ? d : d.rows ?? d.data ?? [];
@@ -8411,17 +8412,20 @@ async function runYmc(args, globalOpts) {
8411
8412
  case "url-stats": {
8412
8413
  const uri = positionals(rest)[0];
8413
8414
  if (!uri) {
8414
- console.error("用法:bfi ymc url-stats </uri> -e <env> [-t <time> | --start-time <t> [--end-time <t>]]");
8415
+ console.error("用法:bfi ymc url-stats </uri> -e <env> [-t <time>] [--app <service_name>]");
8415
8416
  process.exit(1);
8416
8417
  }
8417
- emit(await api.call("kibana/stats", {
8418
+ const body = {
8418
8419
  uri,
8419
8420
  ...requireEnv(rest),
8420
8421
  ...timeOpts(rest)
8421
- }), jsonMode, (data) => {
8422
+ };
8423
+ const app = opt(rest, "--app");
8424
+ if (app) body.filters = { service_name: app };
8425
+ emit(await api.call("kibana/stats", body), jsonMode, (data) => {
8422
8426
  const d = data;
8423
8427
  const a = d.aggs;
8424
- return `✓ URL 统计: QPS=${a.qps} avg=${a.avg_rt?.value ?? "-"} 慢请求Top=${Array.isArray(d.slow_top) ? d.slow_top.length : 0}`;
8428
+ return `✓ URL 统计${app ? ` [${app}]` : "(⚠️ 未限定服务,共享路径为全平台混合)"}: QPS=${a.qps} avg=${a.avg_rt?.value ?? "-"} 慢请求Top=${Array.isArray(d.slow_top) ? d.slow_top.length : 0}`;
8425
8429
  });
8426
8430
  break;
8427
8431
  }
@@ -8433,12 +8437,14 @@ async function runYmc(args, globalOpts) {
8433
8437
  };
8434
8438
  const id = opt(rest, "--trace-id");
8435
8439
  const uri = opt(rest, "--uri");
8440
+ const app = opt(rest, "--app");
8441
+ if (app) body.filters = { service_name: app };
8436
8442
  if (id) body.trace_id = id;
8437
8443
  else if (uri) {
8438
8444
  body.uri = uri;
8439
8445
  body.fuzzy = !flag(rest, "--exact");
8440
8446
  } else {
8441
- console.error("用法:bfi ymc ingress --trace-id <id> | --uri </path> -e <env> [-t time]");
8447
+ console.error("用法:bfi ymc ingress --trace-id <id> | --uri </path> [-app <service_name>] -e <env> [-t time]");
8442
8448
  process.exit(1);
8443
8449
  }
8444
8450
  emit(await api.call("kibana/search", body), jsonMode, rowsSummary("ingress 日志"));
@@ -8737,12 +8743,13 @@ bfi ymc — 观测查询(v2 API:YMC/Kibana/SLS/trace)
8737
8743
  sls-logs <trace_id> -e <env> 原子源:SLS 业务日志
8738
8744
  sls-raw "<查询>" -e <env> SLS 原始查询(完整查询语法透传)
8739
8745
  sls-grep "<关键词>" -e <env> SLS 全文检索聚合(异常历史分布取证)
8740
- slowsql -t <time> [-e] [--sql-str] [--md5] [--trace-id] [--app] [--profiler]
8741
- slowcall -t <time> [-e] [--trace-id] [--app] [--method] [--min-cost ms] [--profiler]
8746
+ slowsql -t <time> [-e] [--sql-str] [--md5] [--trace-id] [--app] [--no-profiler]
8747
+ slowcall -t <time> [-e] [--trace-id] [--app] [--method] [--min-cost ms]
8748
+ [--profiler] # ⚠️ 采样过滤器实测常为空集,常规取证勿带
8742
8749
  exceptions -t <time> [-e] [--app]
8743
8750
  alerts -t <time> [-e] [--level error|warn|info]
8744
- url-stats </uri> -t <time> -e <env>
8745
- ingress --trace-id <id> | --uri </path> [-t <time>] -e <env> [--exact]
8751
+ url-stats </uri> -t <time> -e <env> [--app <service_name>]
8752
+ ingress --trace-id <id> | --uri </path> [-t <time>] -e <env> [--exact] [--app <service_name>]
8746
8753
  dump-list [-t <time>] -e <env> [--app] [--type profiler]
8747
8754
  cases <search|show|upload|index> 案例库(KEDB)
8748
8755
  wiki search "<kw>" [--source] [--titles] 知识库统一检索(wiki/jira/文库)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.67",
3
+ "version": "0.1.69",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {