bfi-cli 0.1.65 → 0.1.67
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.
- package/dist/cli.mjs +21 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -8216,7 +8216,8 @@ async function runYmc(args, globalOpts) {
|
|
|
8216
8216
|
}
|
|
8217
8217
|
emit(await api.call("trace", {
|
|
8218
8218
|
trace_id: id,
|
|
8219
|
-
...requireEnv(rest)
|
|
8219
|
+
...requireEnv(rest),
|
|
8220
|
+
...opt(rest, "--ts") ? { ts: Number(opt(rest, "--ts")) } : {}
|
|
8220
8221
|
}), jsonMode, (data) => {
|
|
8221
8222
|
const d = data;
|
|
8222
8223
|
const lines = [];
|
|
@@ -8254,7 +8255,8 @@ async function runYmc(args, globalOpts) {
|
|
|
8254
8255
|
}
|
|
8255
8256
|
emit(await api.call("chain", {
|
|
8256
8257
|
trace_id: id,
|
|
8257
|
-
...requireEnv(rest)
|
|
8258
|
+
...requireEnv(rest),
|
|
8259
|
+
...opt(rest, "--ts") ? { ts: Number(opt(rest, "--ts")) } : {}
|
|
8258
8260
|
}), jsonMode, (data) => {
|
|
8259
8261
|
const d = data;
|
|
8260
8262
|
return `✓ 链路查询: ts=${d.ts}(${d.ts_source})chain=${d.warning_chain ? "有" : "无"}`;
|
|
@@ -8277,7 +8279,21 @@ async function runYmc(args, globalOpts) {
|
|
|
8277
8279
|
...opt(rest, "--days") ? { days: Number(opt(rest, "--days")) } : {},
|
|
8278
8280
|
...opt(rest, "--line") ? { line: Number(opt(rest, "--line")) } : {}
|
|
8279
8281
|
};
|
|
8280
|
-
emit(await api.call("sls/raw", body), jsonMode,
|
|
8282
|
+
emit(await api.call("sls/raw", body), jsonMode, (data) => {
|
|
8283
|
+
const d = data;
|
|
8284
|
+
const rows = Array.isArray(d) ? d : d.rows ?? d.data ?? [];
|
|
8285
|
+
const n = rows.length;
|
|
8286
|
+
if (!n) return "✓ SLS 原始查询: 0 行";
|
|
8287
|
+
const times = rows.map((x) => Number(x.__time__)).filter(Boolean);
|
|
8288
|
+
const fmt = (t) => (/* @__PURE__ */ new Date(t * 1e3)).toLocaleString("zh-CN", { hour12: false });
|
|
8289
|
+
const span = times.length ? `时间范围 ${fmt(Math.min(...times))} ~ ${fmt(Math.max(...times))}` : "";
|
|
8290
|
+
const keys = Object.keys(rows[0]).slice(0, 8).join(",");
|
|
8291
|
+
return [
|
|
8292
|
+
`✓ SLS 原始查询: ${n} 行 ${span}`,
|
|
8293
|
+
`字段: ${keys}`,
|
|
8294
|
+
`样本: ${JSON.stringify(rows[0]).slice(0, 200)}`
|
|
8295
|
+
].join("\n");
|
|
8296
|
+
});
|
|
8281
8297
|
break;
|
|
8282
8298
|
}
|
|
8283
8299
|
case "sls-grep": {
|
|
@@ -8307,7 +8323,8 @@ async function runYmc(args, globalOpts) {
|
|
|
8307
8323
|
}
|
|
8308
8324
|
emit(await api.call("sls/logs", {
|
|
8309
8325
|
trace_id: id,
|
|
8310
|
-
...requireEnv(rest)
|
|
8326
|
+
...requireEnv(rest),
|
|
8327
|
+
...opt(rest, "--ts") ? { ts: Number(opt(rest, "--ts")) } : {}
|
|
8311
8328
|
}), jsonMode, rowsSummary("SLS 日志"));
|
|
8312
8329
|
break;
|
|
8313
8330
|
}
|