trace-viz 0.3.0
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +385 -0
- package/dist/adapters/index.d.ts +32 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +83 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/agent.d.ts +66 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +329 -0
- package/dist/agent.js.map +1 -0
- package/dist/atlas/atlas.d.ts +203 -0
- package/dist/atlas/atlas.d.ts.map +1 -0
- package/dist/atlas/atlas.js +1466 -0
- package/dist/atlas/atlas.js.map +1 -0
- package/dist/atlas/index.d.ts +7 -0
- package/dist/atlas/index.d.ts.map +1 -0
- package/dist/atlas/index.js +4 -0
- package/dist/atlas/index.js.map +1 -0
- package/dist/atlas/layout.d.ts +44 -0
- package/dist/atlas/layout.d.ts.map +1 -0
- package/dist/atlas/layout.js +103 -0
- package/dist/atlas/layout.js.map +1 -0
- package/dist/atlas/model.d.ts +164 -0
- package/dist/atlas/model.d.ts.map +1 -0
- package/dist/atlas/model.js +489 -0
- package/dist/atlas/model.js.map +1 -0
- package/dist/channels.d.ts +105 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +411 -0
- package/dist/channels.js.map +1 -0
- package/dist/components.d.ts +76 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +432 -0
- package/dist/components.js.map +1 -0
- package/dist/estate.d.ts +25 -0
- package/dist/estate.d.ts.map +1 -0
- package/dist/estate.js +285 -0
- package/dist/estate.js.map +1 -0
- package/dist/failure.d.ts +36 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +82 -0
- package/dist/failure.js.map +1 -0
- package/dist/geometry.d.ts +24 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +92 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +66 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +152 -0
- package/dist/layout.js.map +1 -0
- package/dist/layout3d.d.ts +98 -0
- package/dist/layout3d.d.ts.map +1 -0
- package/dist/layout3d.js +350 -0
- package/dist/layout3d.js.map +1 -0
- package/dist/mesh.d.ts +23 -0
- package/dist/mesh.d.ts.map +1 -0
- package/dist/mesh.js +263 -0
- package/dist/mesh.js.map +1 -0
- package/dist/model.d.ts +94 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +84 -0
- package/dist/model.js.map +1 -0
- package/dist/particles.d.ts +80 -0
- package/dist/particles.d.ts.map +1 -0
- package/dist/particles.js +118 -0
- package/dist/particles.js.map +1 -0
- package/dist/project.d.ts +113 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +288 -0
- package/dist/project.js.map +1 -0
- package/dist/react/index.d.ts +22 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +69 -0
- package/dist/react/index.js.map +1 -0
- package/dist/renderer.d.ts +252 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +1710 -0
- package/dist/renderer.js.map +1 -0
- package/dist/scales.d.ts +99 -0
- package/dist/scales.d.ts.map +1 -0
- package/dist/scales.js +126 -0
- package/dist/scales.js.map +1 -0
- package/dist/scene.d.ts +53 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +44 -0
- package/dist/scene.js.map +1 -0
- package/dist/schema.d.ts +24 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +131 -0
- package/dist/schema.js.map +1 -0
- package/dist/seed.d.ts +33 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +173 -0
- package/dist/seed.js.map +1 -0
- package/dist/theme.d.ts +35 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +83 -0
- package/dist/theme.js.map +1 -0
- package/dist/trace-viz.esm.js +15 -0
- package/dist/trace-viz.min.js +15 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +105 -0
package/dist/mesh.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh.js","sourceRoot":"","sources":["../src/mesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAoB5C,+EAA+E;AAC/E,oEAAoE;AACpE,MAAM,OAAO,GAAiC;IAC5C,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,0BAA0B,CAAC,CAAC;IACxF,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAC3D,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,CAAC,CAAC;IACjF,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;IACxE,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;IACjF,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACpD,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,eAAe,EAAE,c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AY,CAAC,MAAc,EAAE,MAAc;IAClD,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC;QACxC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;YACxB,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;gBACpB,CAAC,CAAC,GAAG;gBACL,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;oBACtB,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC;wBACnC,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,CAAC,CAAC;IACd,OAAO,IAAI,GAAG,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC7D,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dimensional model.
|
|
3
|
+
*
|
|
4
|
+
* v0.1 had one shape: a node is a box, an edge is a number. That shape cannot
|
|
5
|
+
* express a real system, where a "service" is a dozen APIs, each API is
|
|
6
|
+
* deployed into several environments and regions, and each dependency has its
|
|
7
|
+
* own failure semantics. Those are all *dimensions* of the same traffic.
|
|
8
|
+
*
|
|
9
|
+
* So the input is a flat table of flows carrying arbitrary dimensions, and the
|
|
10
|
+
* picture is a **projection** of it. Which dimensions define a node, which are
|
|
11
|
+
* filtered away, and which drive a visual channel are all runtime choices - the
|
|
12
|
+
* knobs. Nothing here is drawn; see `project.ts` and `channels.ts`.
|
|
13
|
+
*/
|
|
14
|
+
/** Values a dimension can take. Everything is stringly-typed on purpose: dimensions are categorical. */
|
|
15
|
+
export type DimValues = Record<string, string>;
|
|
16
|
+
export interface FlowMeasures {
|
|
17
|
+
rps: number;
|
|
18
|
+
latencyMs?: number;
|
|
19
|
+
errorRate?: number;
|
|
20
|
+
bytes?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Derived, never supplied: this edge's rps as a fraction of everything its
|
|
23
|
+
* caller sends. 0.8 means the caller puts most of its traffic here - that is
|
|
24
|
+
* coupling, and it is what `distance` pulls on by default.
|
|
25
|
+
*/
|
|
26
|
+
share?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One measured flow between two endpoints.
|
|
30
|
+
*
|
|
31
|
+
* `from` and `to` are coordinates in dimension space, not ids: `{ service:
|
|
32
|
+
* 'orders', api: 'POST /orders' }`. What counts as a node is decided later, by
|
|
33
|
+
* the projection. `dims` holds dimensions of the flow itself - the region it
|
|
34
|
+
* was measured in, the environment, whether the caller fails closed on it.
|
|
35
|
+
*/
|
|
36
|
+
export interface FlowRecord {
|
|
37
|
+
from: DimValues;
|
|
38
|
+
to: DimValues;
|
|
39
|
+
dims?: DimValues;
|
|
40
|
+
metrics: FlowMeasures;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A fact about a *thing*, not a flow: how many instances it runs, what engine
|
|
44
|
+
* it is, how hot its CPU is. `key` is a partial coordinate - it attaches to
|
|
45
|
+
* every node whose identity is consistent with it, at whatever resolution the
|
|
46
|
+
* current projection happens to use.
|
|
47
|
+
*/
|
|
48
|
+
export interface NodeFact {
|
|
49
|
+
key: DimValues;
|
|
50
|
+
/** Numeric attributes: instances, cpu, mem, disk, connections - anything. */
|
|
51
|
+
attrs?: Record<string, number>;
|
|
52
|
+
/** Force a particular world component, e.g. "db-drum". */
|
|
53
|
+
component?: string;
|
|
54
|
+
/** Extra dimensions carried by the thing itself, e.g. engine or team. */
|
|
55
|
+
dims?: DimValues;
|
|
56
|
+
}
|
|
57
|
+
export interface FlowTable {
|
|
58
|
+
version?: 1;
|
|
59
|
+
records: FlowRecord[];
|
|
60
|
+
/** Optional per-thing facts, used by world mode for size, gauges and shape. */
|
|
61
|
+
nodes?: NodeFact[];
|
|
62
|
+
meta?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
export interface DimensionMeta {
|
|
65
|
+
name: string;
|
|
66
|
+
/** Distinct values, sorted. Truncated at `maxValues` with `truncated: true`. */
|
|
67
|
+
values: string[];
|
|
68
|
+
cardinality: number;
|
|
69
|
+
truncated: boolean;
|
|
70
|
+
/** True when the dimension appears on `from`/`to` and can therefore define node identity. */
|
|
71
|
+
endpoint: boolean;
|
|
72
|
+
/** True when it appears on the flow itself and can therefore split an edge into lanes. */
|
|
73
|
+
flow: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface TableSchema {
|
|
76
|
+
dimensions: DimensionMeta[];
|
|
77
|
+
measures: string[];
|
|
78
|
+
/** Numeric node attributes available for size, gauges and distance. */
|
|
79
|
+
nodeAttrs: string[];
|
|
80
|
+
records: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Describe what knobs a table actually offers.
|
|
84
|
+
*
|
|
85
|
+
* Cardinality matters for more than documentation: a 40-value dimension on a
|
|
86
|
+
* colour channel is unreadable, and both the UI and the spec agent use these
|
|
87
|
+
* counts to refuse that binding.
|
|
88
|
+
*/
|
|
89
|
+
export declare function describeTable(table: FlowTable, maxValues?: number): TableSchema;
|
|
90
|
+
/** Every dimension available on a flow, endpoint dimensions winning on collision. */
|
|
91
|
+
export declare function endpointDims(record: FlowRecord, side: 'from' | 'to'): DimValues;
|
|
92
|
+
/** Look up a field on a record, whichever side of it lives on. */
|
|
93
|
+
export declare function fieldValue(record: FlowRecord, field: string, side?: 'from' | 'to'): string | undefined;
|
|
94
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"A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,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uEAAuE;IACvE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,SAAK,GAAG,WAAW,CA+C3E;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAE/E;AAED,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAMtG"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dimensional model.
|
|
3
|
+
*
|
|
4
|
+
* v0.1 had one shape: a node is a box, an edge is a number. That shape cannot
|
|
5
|
+
* express a real system, where a "service" is a dozen APIs, each API is
|
|
6
|
+
* deployed into several environments and regions, and each dependency has its
|
|
7
|
+
* own failure semantics. Those are all *dimensions* of the same traffic.
|
|
8
|
+
*
|
|
9
|
+
* So the input is a flat table of flows carrying arbitrary dimensions, and the
|
|
10
|
+
* picture is a **projection** of it. Which dimensions define a node, which are
|
|
11
|
+
* filtered away, and which drive a visual channel are all runtime choices - the
|
|
12
|
+
* knobs. Nothing here is drawn; see `project.ts` and `channels.ts`.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Describe what knobs a table actually offers.
|
|
16
|
+
*
|
|
17
|
+
* Cardinality matters for more than documentation: a 40-value dimension on a
|
|
18
|
+
* colour channel is unreadable, and both the UI and the spec agent use these
|
|
19
|
+
* counts to refuse that binding.
|
|
20
|
+
*/
|
|
21
|
+
export function describeTable(table, maxValues = 64) {
|
|
22
|
+
const seen = new Map();
|
|
23
|
+
const measures = new Set();
|
|
24
|
+
const note = (dims, where) => {
|
|
25
|
+
if (!dims)
|
|
26
|
+
return;
|
|
27
|
+
for (const [k, v] of Object.entries(dims)) {
|
|
28
|
+
let entry = seen.get(k);
|
|
29
|
+
if (!entry)
|
|
30
|
+
seen.set(k, (entry = { values: new Set(), endpoint: false, flow: false }));
|
|
31
|
+
entry.values.add(v);
|
|
32
|
+
entry[where] = true;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
for (const r of table.records) {
|
|
36
|
+
note(r.from, 'endpoint');
|
|
37
|
+
note(r.to, 'endpoint');
|
|
38
|
+
note(r.dims, 'flow');
|
|
39
|
+
for (const [k, v] of Object.entries(r.metrics))
|
|
40
|
+
if (typeof v === 'number')
|
|
41
|
+
measures.add(k);
|
|
42
|
+
}
|
|
43
|
+
const nodeAttrs = new Set();
|
|
44
|
+
for (const f of table.nodes ?? []) {
|
|
45
|
+
note(f.key, 'endpoint');
|
|
46
|
+
note(f.dims, 'endpoint');
|
|
47
|
+
for (const k of Object.keys(f.attrs ?? {}))
|
|
48
|
+
nodeAttrs.add(k);
|
|
49
|
+
}
|
|
50
|
+
const dimensions = [...seen.entries()]
|
|
51
|
+
.map(([name, e]) => {
|
|
52
|
+
const all = [...e.values].sort();
|
|
53
|
+
return {
|
|
54
|
+
name,
|
|
55
|
+
values: all.slice(0, maxValues),
|
|
56
|
+
cardinality: all.length,
|
|
57
|
+
truncated: all.length > maxValues,
|
|
58
|
+
endpoint: e.endpoint,
|
|
59
|
+
flow: e.flow,
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
.sort((a, b) => a.cardinality - b.cardinality || a.name.localeCompare(b.name));
|
|
63
|
+
// `share` is computed at projection time from rps, so it is always available;
|
|
64
|
+
// so is a per-node errorRate, rolled up from the flows a node serves.
|
|
65
|
+
if (measures.has('rps'))
|
|
66
|
+
measures.add('share');
|
|
67
|
+
if (measures.has('errorRate'))
|
|
68
|
+
nodeAttrs.add('errorRate');
|
|
69
|
+
return { dimensions, measures: [...measures].sort(), nodeAttrs: [...nodeAttrs].sort(), records: table.records.length };
|
|
70
|
+
}
|
|
71
|
+
/** Every dimension available on a flow, endpoint dimensions winning on collision. */
|
|
72
|
+
export function endpointDims(record, side) {
|
|
73
|
+
return { ...record.dims, ...record[side] };
|
|
74
|
+
}
|
|
75
|
+
/** Look up a field on a record, whichever side of it lives on. */
|
|
76
|
+
export function fieldValue(record, field, side) {
|
|
77
|
+
if (side) {
|
|
78
|
+
const v = record[side][field];
|
|
79
|
+
if (v !== undefined)
|
|
80
|
+
return v;
|
|
81
|
+
}
|
|
82
|
+
return record.dims?.[field] ?? record.from[field] ?? record.to[field];
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA6EH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,SAAS,GAAG,EAAE;IAC5D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAqE,CAAC;IAC1F,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAEnC,MAAM,IAAI,GAAG,CAAC,IAA2B,EAAE,KAA0B,EAAQ,EAAE;QAC7E,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,KAAK;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,IAAI,GAAG,EAA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AG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { EdgePath } from './geometry.js';
|
|
2
|
+
import { type EncodingOptions } from './scales.js';
|
|
3
|
+
export interface Particle {
|
|
4
|
+
/** Position along the path, 0..1. */
|
|
5
|
+
t: number;
|
|
6
|
+
/** Pixels per second. */
|
|
7
|
+
speed: number;
|
|
8
|
+
radius: number;
|
|
9
|
+
error: boolean;
|
|
10
|
+
/** Small lateral jitter so the stream reads as a stream, not a queue. */
|
|
11
|
+
wobble: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One edge's particle stream.
|
|
15
|
+
*
|
|
16
|
+
* Emission is accumulator-based rather than "one particle per frame", so the
|
|
17
|
+
* density on screen tracks rps rather than the viewer's refresh rate. A 144Hz
|
|
18
|
+
* monitor must not make the system look busier than a 60Hz one.
|
|
19
|
+
*/
|
|
20
|
+
/** The minimum an edge must expose to carry a stream. */
|
|
21
|
+
export interface StreamEdge {
|
|
22
|
+
id: string;
|
|
23
|
+
metrics: {
|
|
24
|
+
rps: number;
|
|
25
|
+
latencyMs: number;
|
|
26
|
+
errorRate: number;
|
|
27
|
+
bytes: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare class EdgeStream {
|
|
31
|
+
readonly edge: StreamEdge;
|
|
32
|
+
particles: Particle[];
|
|
33
|
+
private accumulator;
|
|
34
|
+
private emitPerSecond;
|
|
35
|
+
private speedPxPerSecond;
|
|
36
|
+
private radius;
|
|
37
|
+
private rand;
|
|
38
|
+
private stopped;
|
|
39
|
+
private overrideErrorRate;
|
|
40
|
+
private spreadPx;
|
|
41
|
+
private phased;
|
|
42
|
+
constructor(edge: StreamEdge, rand?: () => number);
|
|
43
|
+
/** Recompute the encoding. Call when metrics or the rps domain changes. */
|
|
44
|
+
configure(domain: {
|
|
45
|
+
min: number;
|
|
46
|
+
max: number;
|
|
47
|
+
}, enc?: EncodingOptions): void;
|
|
48
|
+
/**
|
|
49
|
+
* Set the resolved channel values directly. The dimensional path computes
|
|
50
|
+
* density, speed and radius from arbitrary bindings, so the stream must not
|
|
51
|
+
* re-derive them from rps/latency.
|
|
52
|
+
*/
|
|
53
|
+
configureDirect(density: number, speed: number, radius: number, errorRate: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* How this stream shares its conduit with the other lanes on the same edge.
|
|
56
|
+
*
|
|
57
|
+
* `spread` is how far particles scatter across the conduit, and `phase` is
|
|
58
|
+
* where in the emission cycle this lane starts. Two lanes drawn on the same
|
|
59
|
+
* path with the same phase would emit in lockstep and read as one alternating
|
|
60
|
+
* chain; offset phases and a wide scatter make them mix, which is what you
|
|
61
|
+
* want when the split is small enough to overlay - blue and green in the same
|
|
62
|
+
* pipe rather than two tidy parallel dotted lines.
|
|
63
|
+
*/
|
|
64
|
+
setLane(spread: number, phase?: number): void;
|
|
65
|
+
/** Cut emission without clearing what is already in flight - a severed edge drains. */
|
|
66
|
+
stopEmitting(): void;
|
|
67
|
+
resumeEmitting(): void;
|
|
68
|
+
get emitRate(): number;
|
|
69
|
+
get speed(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Advance by `dt` seconds along `path`, at `rate` speed multiplier.
|
|
72
|
+
* Returns the number of particles that completed the trip, which the caller
|
|
73
|
+
* can use for a delivered-requests counter.
|
|
74
|
+
*/
|
|
75
|
+
step(dt: number, path: EdgePath, enc?: EncodingOptions, rate?: number): number;
|
|
76
|
+
clear(): void;
|
|
77
|
+
}
|
|
78
|
+
/** Deterministic PRNG (mulberry32) - lets tests and screenshots reproduce. */
|
|
79
|
+
export declare function mulberry32(seed: number): () => number;
|
|
80
|
+
//# sourceMappingURL=particles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particles.d.ts","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,yDAAyD;AACzD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/E;AAED,qBAAa,UAAU;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,MAAM,CAAS;gBAEX,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,MAAM,MAAoB;IAK9D,2EAA2E;IAC3E,SAAS,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,GAAE,eAAiC,GAAG,IAAI;IAM7F;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAOxF;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,IAAI;IAQxC,uFAAuF;IACvF,YAAY,IAAI,IAAI;IAKpB,cAAc,IAAI,IAAI;IAItB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAE,eAAiC,EAAE,IAAI,SAAI,GAAG,MAAM;IAuC1F,KAAK,IAAI,IAAI;CAMd;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAQrD"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { defaultEncoding, emissionRate, particleRadius, particleSpeed, } from './scales.js';
|
|
2
|
+
export class EdgeStream {
|
|
3
|
+
constructor(edge, rand = Math.random) {
|
|
4
|
+
this.particles = [];
|
|
5
|
+
this.accumulator = 0;
|
|
6
|
+
this.emitPerSecond = 0;
|
|
7
|
+
this.speedPxPerSecond = 0;
|
|
8
|
+
this.radius = 2;
|
|
9
|
+
this.stopped = false;
|
|
10
|
+
this.overrideErrorRate = null;
|
|
11
|
+
this.spreadPx = 4.2;
|
|
12
|
+
this.phased = false;
|
|
13
|
+
this.edge = edge;
|
|
14
|
+
this.rand = rand;
|
|
15
|
+
}
|
|
16
|
+
/** Recompute the encoding. Call when metrics or the rps domain changes. */
|
|
17
|
+
configure(domain, enc = defaultEncoding) {
|
|
18
|
+
this.emitPerSecond = this.stopped ? 0 : emissionRate(this.edge.metrics.rps, domain, enc);
|
|
19
|
+
this.speedPxPerSecond = particleSpeed(this.edge.metrics.latencyMs, enc);
|
|
20
|
+
this.radius = particleRadius(this.edge.metrics.bytes, enc);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set the resolved channel values directly. The dimensional path computes
|
|
24
|
+
* density, speed and radius from arbitrary bindings, so the stream must not
|
|
25
|
+
* re-derive them from rps/latency.
|
|
26
|
+
*/
|
|
27
|
+
configureDirect(density, speed, radius, errorRate) {
|
|
28
|
+
this.emitPerSecond = this.stopped ? 0 : density;
|
|
29
|
+
this.speedPxPerSecond = speed;
|
|
30
|
+
this.radius = radius;
|
|
31
|
+
this.overrideErrorRate = errorRate;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* How this stream shares its conduit with the other lanes on the same edge.
|
|
35
|
+
*
|
|
36
|
+
* `spread` is how far particles scatter across the conduit, and `phase` is
|
|
37
|
+
* where in the emission cycle this lane starts. Two lanes drawn on the same
|
|
38
|
+
* path with the same phase would emit in lockstep and read as one alternating
|
|
39
|
+
* chain; offset phases and a wide scatter make them mix, which is what you
|
|
40
|
+
* want when the split is small enough to overlay - blue and green in the same
|
|
41
|
+
* pipe rather than two tidy parallel dotted lines.
|
|
42
|
+
*/
|
|
43
|
+
setLane(spread, phase = 0) {
|
|
44
|
+
this.spreadPx = spread;
|
|
45
|
+
if (!this.phased) {
|
|
46
|
+
this.accumulator = phase;
|
|
47
|
+
this.phased = true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Cut emission without clearing what is already in flight - a severed edge drains. */
|
|
51
|
+
stopEmitting() {
|
|
52
|
+
this.stopped = true;
|
|
53
|
+
this.emitPerSecond = 0;
|
|
54
|
+
}
|
|
55
|
+
resumeEmitting() {
|
|
56
|
+
this.stopped = false;
|
|
57
|
+
}
|
|
58
|
+
get emitRate() {
|
|
59
|
+
return this.emitPerSecond;
|
|
60
|
+
}
|
|
61
|
+
get speed() {
|
|
62
|
+
return this.speedPxPerSecond;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Advance by `dt` seconds along `path`, at `rate` speed multiplier.
|
|
66
|
+
* Returns the number of particles that completed the trip, which the caller
|
|
67
|
+
* can use for a delivered-requests counter.
|
|
68
|
+
*/
|
|
69
|
+
step(dt, path, enc = defaultEncoding, rate = 1) {
|
|
70
|
+
const errorRate = this.overrideErrorRate ?? this.edge.metrics.errorRate;
|
|
71
|
+
if (this.emitPerSecond > 0) {
|
|
72
|
+
this.accumulator += this.emitPerSecond * dt * rate;
|
|
73
|
+
// Cap the backlog: a long tab-away must not dump 10k particles at once.
|
|
74
|
+
const budget = Math.min(Math.floor(this.accumulator), Math.max(0, enc.maxParticlesPerEdge - this.particles.length), 120);
|
|
75
|
+
this.accumulator -= Math.floor(this.accumulator);
|
|
76
|
+
for (let i = 0; i < budget; i++) {
|
|
77
|
+
this.particles.push({
|
|
78
|
+
// Spread new arrivals across the frame's worth of travel so they do
|
|
79
|
+
// not emerge in visible clumps.
|
|
80
|
+
t: (-i / Math.max(budget, 1)) * (this.speedPxPerSecond * dt) / path.length,
|
|
81
|
+
speed: this.speedPxPerSecond * (0.88 + this.rand() * 0.24),
|
|
82
|
+
radius: this.radius * (0.85 + this.rand() * 0.3),
|
|
83
|
+
error: this.rand() < errorRate,
|
|
84
|
+
wobble: (this.rand() - 0.5) * this.spreadPx,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let delivered = 0;
|
|
89
|
+
const kept = [];
|
|
90
|
+
for (const p of this.particles) {
|
|
91
|
+
p.t += (p.speed * dt * rate) / path.length;
|
|
92
|
+
if (p.t >= 1) {
|
|
93
|
+
delivered++;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
kept.push(p);
|
|
97
|
+
}
|
|
98
|
+
this.particles = kept;
|
|
99
|
+
return delivered;
|
|
100
|
+
}
|
|
101
|
+
clear() {
|
|
102
|
+
this.particles.length = 0;
|
|
103
|
+
this.accumulator = 0;
|
|
104
|
+
this.stopped = false;
|
|
105
|
+
this.phased = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Deterministic PRNG (mulberry32) - lets tests and screenshots reproduce. */
|
|
109
|
+
export function mulberry32(seed) {
|
|
110
|
+
let a = seed >>> 0;
|
|
111
|
+
return () => {
|
|
112
|
+
a = (a + 0x6d2b79f5) >>> 0;
|
|
113
|
+
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
114
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
115
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=particles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particles.js","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,GAEd,MAAM,aAAa,CAAC;AA0BrB,MAAM,OAAO,UAAU;IAarB,YAAY,IAAgB,EAAE,OAAqB,IAAI,CAAC,MAAM;QAX9D,cAAS,GAAe,EAAE,CAAC;QACnB,gBAAW,GAAG,CAAC,CAAC;QAChB,kBAAa,GAAG,CAAC,CAAC;QAClB,qBAAgB,GAAG,CAAC,CAAC;QACrB,WAAM,GAAG,CAAC,CAAC;QAEX,YAAO,GAAG,KAAK,CAAC;QAChB,sBAAiB,GAAkB,IAAI,CAAC;QACxC,aAAQ,GAAG,GAAG,CAAC;QACf,WAAM,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,2EAA2E;IAC3E,SAAS,CAAC,MAAoC,EAAE,MAAuB,eAAe;QACpF,IAAI,CAAC,aAAa,GAAG,IAAI,CAA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G,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type DimValues, type FlowTable } from './model.js';
|
|
2
|
+
import type { Scene } from './scene.js';
|
|
3
|
+
/** How a dimension or measure is bound to one visual channel. */
|
|
4
|
+
export interface ChannelBinding {
|
|
5
|
+
/** Dimension or measure name. */
|
|
6
|
+
field: string;
|
|
7
|
+
/** Override the automatic choice of scale for measures. */
|
|
8
|
+
scale?: 'log' | 'linear' | 'sqrt';
|
|
9
|
+
/** Explicit value-to-visual mapping for dimensions, e.g. { 'fail-closed': 'rigid' }. */
|
|
10
|
+
map?: Record<string, string>;
|
|
11
|
+
/** Palette override for categorical channels. */
|
|
12
|
+
palette?: string[];
|
|
13
|
+
/** Reverse the direction of a measure channel. */
|
|
14
|
+
invert?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* How hard this channel pulls, for `distance`: 0 switches it off, 1 is the
|
|
17
|
+
* default, 2 doubles it. Lets you dial coupling up until the clusters are
|
|
18
|
+
* unmistakable, or down until the layout is calm.
|
|
19
|
+
*/
|
|
20
|
+
strength?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Explicit ordering of a dimension's values, for channels where order is
|
|
23
|
+
* visible: `column` (left to right) and `lane` (top to bottom). Values not
|
|
24
|
+
* listed follow, sorted.
|
|
25
|
+
*/
|
|
26
|
+
order?: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The knobs. Everything about what the picture *is* lives here, and all of it
|
|
30
|
+
* can change between frames.
|
|
31
|
+
*/
|
|
32
|
+
export interface ViewSpec {
|
|
33
|
+
/**
|
|
34
|
+
* Which dimensions define a node. `['service']` gives you one box per
|
|
35
|
+
* service; `['service','api']` explodes it; `['region','service']` gives you
|
|
36
|
+
* the same service twice, once per region.
|
|
37
|
+
*/
|
|
38
|
+
nodeKey: string[];
|
|
39
|
+
/** Keep only records whose dimension values are in these sets. */
|
|
40
|
+
where?: Record<string, string[]>;
|
|
41
|
+
/** dimension or measure -> visual channel. */
|
|
42
|
+
channels?: Record<string, ChannelBinding>;
|
|
43
|
+
/** Node ids to kill, for the blast-radius view. */
|
|
44
|
+
killed?: string[];
|
|
45
|
+
/** Drop edges that collapse onto a single node (intra-group calls). */
|
|
46
|
+
dropSelfEdges?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Expand one part of the graph without expanding all of it.
|
|
49
|
+
*
|
|
50
|
+
* `{ match: { service: 'orders' }, expandBy: ['api'] }` keeps every other
|
|
51
|
+
* service as a single box and explodes just this one into its APIs. This is
|
|
52
|
+
* how you look at the APIs of one service without turning the whole picture
|
|
53
|
+
* into forty nodes.
|
|
54
|
+
*/
|
|
55
|
+
focus?: {
|
|
56
|
+
match: DimValues;
|
|
57
|
+
expandBy: string[];
|
|
58
|
+
};
|
|
59
|
+
/** Render as a flat topology or as a tiered 3D world. */
|
|
60
|
+
mode?: 'flat' | 'world';
|
|
61
|
+
/** Knobs on the flat layout. */
|
|
62
|
+
layout?: {
|
|
63
|
+
/** How rows inside a column are ordered: fewest crossings, by name, or by traffic. */
|
|
64
|
+
rowSort?: 'auto' | 'name' | 'traffic';
|
|
65
|
+
};
|
|
66
|
+
world?: WorldSpec;
|
|
67
|
+
/** Human note shown with the view. */
|
|
68
|
+
title?: string;
|
|
69
|
+
}
|
|
70
|
+
/** How the miniature world is composed - all of it selected from registered components. */
|
|
71
|
+
export interface WorldSpec {
|
|
72
|
+
/** Dimension deciding which plane a node sits on; omitted means infer from node kind. */
|
|
73
|
+
tierBy?: string;
|
|
74
|
+
/** Ordered tier values, top to bottom. */
|
|
75
|
+
tiers?: string[];
|
|
76
|
+
/** Dimension deciding the component silhouette. */
|
|
77
|
+
componentBy?: string;
|
|
78
|
+
/** value -> registered component name. */
|
|
79
|
+
componentMap?: Record<string, string>;
|
|
80
|
+
/** Node attribute driving visible mass, default "instances". */
|
|
81
|
+
instances?: string;
|
|
82
|
+
/** Node attributes drawn as gauges on the body, default ["cpu","mem"]. */
|
|
83
|
+
gauges?: string[];
|
|
84
|
+
/** Camera yaw in radians. The renderer also lets you drag it. */
|
|
85
|
+
yaw?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface ProjectionResult {
|
|
88
|
+
scene: Scene;
|
|
89
|
+
/** Dimensions that split edges into separate lanes, because a channel is bound to them. */
|
|
90
|
+
splitBy: string[];
|
|
91
|
+
/** Records that survived the filter. */
|
|
92
|
+
matched: number;
|
|
93
|
+
/** Records rejected by the filter. */
|
|
94
|
+
filtered: number;
|
|
95
|
+
}
|
|
96
|
+
export declare function nodeIdFor(dims: DimValues, nodeKey: string[]): string;
|
|
97
|
+
/**
|
|
98
|
+
* Roll a flow table up into a drawable scene.
|
|
99
|
+
*
|
|
100
|
+
* Two things happen that are easy to miss and matter a lot:
|
|
101
|
+
*
|
|
102
|
+
* 1. Binding a *dimension* to any per-edge channel adds it to `splitBy`, so the
|
|
103
|
+
* edges are grouped by it rather than averaged over it. Colouring by region
|
|
104
|
+
* therefore turns one edge into two lanes, one per region - which is the
|
|
105
|
+
* honest picture. Averaging a dimension you are also encoding would draw a
|
|
106
|
+
* colour that describes nothing.
|
|
107
|
+
* 2. Measures aggregate differently by kind: throughput sums, everything else
|
|
108
|
+
* is a throughput-weighted mean. A 10k rps hop at 2ms and a 1 rps hop at 900ms
|
|
109
|
+
* do not average to 451ms.
|
|
110
|
+
*/
|
|
111
|
+
export declare function project(table: FlowTable, spec: ViewSpec): ProjectionResult;
|
|
112
|
+
export declare function isMeasure(field: string): boolean;
|
|
113
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,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