@contrail/cli 3.5.0-alpha.9d881a5 → 3.5.0-alpha.dd20a19
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/README.md +1 -1
- package/dist/commands/event-workflows/assess-impact.js +0 -3
- package/dist/helpers/event-workflow-impact/aggregate.d.ts +0 -9
- package/dist/helpers/event-workflow-impact/aggregate.js +1 -17
- package/dist/helpers/event-workflow-impact/aggregate.spec.js +0 -25
- package/dist/helpers/event-workflow-impact/render.d.ts +1 -2
- package/dist/helpers/event-workflow-impact/render.js +0 -15
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.5.0-alpha.
|
|
20
|
+
@contrail/cli/3.5.0-alpha.dd20a19 linux-x64 node-v24.14.1
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -68,7 +68,6 @@ class AssessImpact extends basecommand_1.BaseCommand {
|
|
|
68
68
|
}
|
|
69
69
|
this.log(`Got ${traceIds.length} trace(s). Fetching subtrees...`);
|
|
70
70
|
const perTraceDescendants = [];
|
|
71
|
-
const actionDurationsNs = [];
|
|
72
71
|
let dropped = 0;
|
|
73
72
|
let totalOrphans = 0;
|
|
74
73
|
let preciseRootCount = 0;
|
|
@@ -80,7 +79,6 @@ class AssessImpact extends basecommand_1.BaseCommand {
|
|
|
80
79
|
continue;
|
|
81
80
|
}
|
|
82
81
|
perTraceDescendants.push(result.descendants);
|
|
83
|
-
actionDurationsNs.push(result.actionSpan.durationNs);
|
|
84
82
|
totalOrphans += result.orphanCount;
|
|
85
83
|
if (result.preciseRoot)
|
|
86
84
|
preciseRootCount++;
|
|
@@ -100,7 +98,6 @@ class AssessImpact extends basecommand_1.BaseCommand {
|
|
|
100
98
|
tracesDropped: dropped,
|
|
101
99
|
totalOrphanCount: totalOrphans,
|
|
102
100
|
preciseRootCount,
|
|
103
|
-
actionDuration: (0, aggregate_1.summarizeDurations)(actionDurationsNs),
|
|
104
101
|
}));
|
|
105
102
|
}
|
|
106
103
|
}
|
|
@@ -21,12 +21,3 @@ export interface AggregateResult {
|
|
|
21
21
|
}
|
|
22
22
|
export declare function aggregate(input: AggregateInput): AggregateResult;
|
|
23
23
|
export declare function percentile(values: number[], p: number): number;
|
|
24
|
-
export interface DurationStats {
|
|
25
|
-
count: number;
|
|
26
|
-
meanMs: number;
|
|
27
|
-
p50Ms: number;
|
|
28
|
-
p95Ms: number;
|
|
29
|
-
p99Ms: number;
|
|
30
|
-
maxMs: number;
|
|
31
|
-
}
|
|
32
|
-
export declare function summarizeDurations(durationsNs: bigint[]): DurationStats;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.percentile = exports.aggregate = void 0;
|
|
4
4
|
const classify_1 = require("./classify");
|
|
5
5
|
const keyId = (k) => `${k.category}\x1f${k.service}\x1f${k.operation}`;
|
|
6
6
|
function aggregate(input) {
|
|
@@ -47,19 +47,3 @@ function percentile(values, p) {
|
|
|
47
47
|
return sorted[idx];
|
|
48
48
|
}
|
|
49
49
|
exports.percentile = percentile;
|
|
50
|
-
function summarizeDurations(durationsNs) {
|
|
51
|
-
const ms = durationsNs.map((n) => Number(n / 1000000n));
|
|
52
|
-
if (ms.length === 0) {
|
|
53
|
-
return { count: 0, meanMs: 0, p50Ms: 0, p95Ms: 0, p99Ms: 0, maxMs: 0 };
|
|
54
|
-
}
|
|
55
|
-
const sum = ms.reduce((a, b) => a + b, 0);
|
|
56
|
-
return {
|
|
57
|
-
count: ms.length,
|
|
58
|
-
meanMs: sum / ms.length,
|
|
59
|
-
p50Ms: percentile(ms, 0.5),
|
|
60
|
-
p95Ms: percentile(ms, 0.95),
|
|
61
|
-
p99Ms: percentile(ms, 0.99),
|
|
62
|
-
maxMs: ms.reduce((a, b) => Math.max(a, b), 0),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
exports.summarizeDurations = summarizeDurations;
|
|
@@ -107,28 +107,3 @@ describe('aggregate', () => {
|
|
|
107
107
|
expect(result.buckets).toHaveLength(0);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
|
-
describe('summarizeDurations', () => {
|
|
111
|
-
it('returns zeros for empty input', () => {
|
|
112
|
-
expect((0, aggregate_1.summarizeDurations)([])).toEqual({
|
|
113
|
-
count: 0,
|
|
114
|
-
meanMs: 0,
|
|
115
|
-
p50Ms: 0,
|
|
116
|
-
p95Ms: 0,
|
|
117
|
-
p99Ms: 0,
|
|
118
|
-
maxMs: 0,
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
it('converts ns to ms and computes mean + nearest-rank percentiles', () => {
|
|
122
|
-
// 10 values: 100ms, 200ms, ..., 1000ms.
|
|
123
|
-
const ns = [];
|
|
124
|
-
for (let i = 1; i <= 10; i++)
|
|
125
|
-
ns.push(BigInt(i * 100) * 1000000n);
|
|
126
|
-
const stats = (0, aggregate_1.summarizeDurations)(ns);
|
|
127
|
-
expect(stats.count).toBe(10);
|
|
128
|
-
expect(stats.meanMs).toBe(550); // sum=5500, n=10
|
|
129
|
-
expect(stats.p50Ms).toBe(500); // ceil(0.5*10)-1 = 4 → sorted[4] = 500
|
|
130
|
-
expect(stats.p95Ms).toBe(1000); // ceil(0.95*10)-1 = 9 → sorted[9] = 1000
|
|
131
|
-
expect(stats.p99Ms).toBe(1000);
|
|
132
|
-
expect(stats.maxMs).toBe(1000);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AggregateResult
|
|
1
|
+
import { AggregateResult } from './aggregate';
|
|
2
2
|
export interface RenderOptions {
|
|
3
3
|
identifier: string;
|
|
4
4
|
dataset: string;
|
|
@@ -8,6 +8,5 @@ export interface RenderOptions {
|
|
|
8
8
|
tracesDropped: number;
|
|
9
9
|
totalOrphanCount: number;
|
|
10
10
|
preciseRootCount: number;
|
|
11
|
-
actionDuration: DurationStats;
|
|
12
11
|
}
|
|
13
12
|
export declare function renderReport(result: AggregateResult, opts: RenderOptions): string;
|
|
@@ -15,14 +15,6 @@ function renderReport(result, opts) {
|
|
|
15
15
|
lines.push(`Rooting: ${opts.preciseRootCount} precise / ${fallback} fallback (no inner action span — framework AWS-SDK direct children stripped heuristically)`);
|
|
16
16
|
}
|
|
17
17
|
lines.push('');
|
|
18
|
-
const d = opts.actionDuration;
|
|
19
|
-
if (d.count > 0) {
|
|
20
|
-
const note = opts.preciseRootCount < opts.samplesObtained
|
|
21
|
-
? ' (includes some framework overhead on fallback-rooted traces)'
|
|
22
|
-
: '';
|
|
23
|
-
lines.push(`Action duration: mean ${fmtMs(d.meanMs)} · p50 ${fmtMs(d.p50Ms)} · p95 ${fmtMs(d.p95Ms)} · p99 ${fmtMs(d.p99Ms)} · max ${fmtMs(d.maxMs)}${note}`);
|
|
24
|
-
lines.push('');
|
|
25
|
-
}
|
|
26
18
|
lines.push('Per-invocation downstream calls. "% of traces" is how often the bucket appears in any invocation; median/p95/max include zeros.');
|
|
27
19
|
lines.push('');
|
|
28
20
|
const byCategory = new Map();
|
|
@@ -68,10 +60,3 @@ exports.renderReport = renderReport;
|
|
|
68
60
|
function fmt(n) {
|
|
69
61
|
return Number.isInteger(n) ? n.toString() : n.toFixed(1);
|
|
70
62
|
}
|
|
71
|
-
function fmtMs(ms) {
|
|
72
|
-
if (ms < 1)
|
|
73
|
-
return `${ms.toFixed(2)}ms`;
|
|
74
|
-
if (ms < 1000)
|
|
75
|
-
return `${Math.round(ms)}ms`;
|
|
76
|
-
return `${(ms / 1000).toFixed(2)}s`;
|
|
77
|
-
}
|
package/oclif.manifest.json
CHANGED