@lssm/lib.observability 0.0.0-canary-20251220002821 → 0.0.0-canary-20251220021406

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lssm/lib.observability
2
2
 
3
- ## 0.0.0-canary-20251220002821
3
+ ## 0.0.0-canary-20251220021406
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -9,7 +9,7 @@
9
9
  ### Patch Changes
10
10
 
11
11
  - Updated dependencies [66a5dfd]
12
- - @lssm/lib.lifecycle@0.0.0-canary-20251220002821
12
+ - @lssm/lib.lifecycle@0.0.0-canary-20251220021406
13
13
 
14
14
  ## 0.5.0
15
15
 
@@ -10,7 +10,7 @@ var RootCauseAnalyzer = class {
10
10
  let culprit;
11
11
  if (candidates.length > 0) {
12
12
  culprit = candidates[0];
13
- notes.push(`Closest deployment ${culprit.id} (${culprit.operation}) at ${culprit.deployedAt.toISOString()}`);
13
+ if (culprit) notes.push(`Closest deployment ${culprit.id} (${culprit.operation}) at ${culprit.deployedAt.toISOString()}`);
14
14
  } else notes.push("No deployments found within lookback window.");
15
15
  if (signal.type === "latency_regression") notes.push("Verify recent schema changes and external dependency latency.");
16
16
  if (signal.type === "error_rate_spike") notes.push("Check SLO monitor for correlated incidents.");
@@ -36,6 +36,8 @@ var IntentAggregator = class {
36
36
  groups.set(key, arr);
37
37
  }
38
38
  return [...groups.values()].map((group) => {
39
+ const first = group[0];
40
+ if (!first) throw new Error("Empty group in aggregation");
39
41
  const durations = group.map((s) => s.durationMs).sort((a, b) => a - b);
40
42
  const errors = group.filter((s) => !s.success);
41
43
  const totalCalls = group.length;
@@ -46,7 +48,7 @@ var IntentAggregator = class {
46
48
  }, {});
47
49
  const timestamps = group.map((s) => s.timestamp.getTime());
48
50
  return {
49
- operation: group[0].operation,
51
+ operation: first.operation,
50
52
  totalCalls,
51
53
  successRate: (totalCalls - errors.length) / totalCalls,
52
54
  errorRate: errors.length / totalCalls,
@@ -69,7 +71,7 @@ var IntentAggregator = class {
69
71
  byTrace.set(sample.traceId, arr);
70
72
  }
71
73
  const sequences = {};
72
- for (const [traceId, events] of byTrace.entries()) {
74
+ for (const events of byTrace.values()) {
73
75
  const ordered = events.sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime());
74
76
  const steps = ordered.map((event) => event.operation.name);
75
77
  if (steps.length < 2) continue;
@@ -87,8 +89,8 @@ var IntentAggregator = class {
87
89
  };
88
90
  function percentile(values, ratio) {
89
91
  if (!values.length) return 0;
90
- if (values.length === 1) return values[0];
91
- return values[Math.min(values.length - 1, Math.floor(ratio * values.length))];
92
+ if (values.length === 1) return values[0] ?? 0;
93
+ return values[Math.min(values.length - 1, Math.floor(ratio * values.length))] ?? 0;
92
94
  }
93
95
 
94
96
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.observability",
3
- "version": "0.0.0-canary-20251220002821",
3
+ "version": "0.0.0-canary-20251220021406",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "scripts": {
@@ -17,14 +17,14 @@
17
17
  "test": "bun run"
18
18
  },
19
19
  "dependencies": {
20
- "@lssm/lib.lifecycle": "0.0.0-canary-20251220002821"
20
+ "@lssm/lib.lifecycle": "0.0.0-canary-20251220021406"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@opentelemetry/api": "*"
24
24
  },
25
25
  "devDependencies": {
26
- "@lssm/tool.tsdown": "0.0.0-canary-20251220002821",
27
- "@lssm/tool.typescript": "0.0.0-canary-20251220002821",
26
+ "@lssm/tool.tsdown": "0.0.0-canary-20251220021406",
27
+ "@lssm/tool.typescript": "0.0.0-canary-20251220021406",
28
28
  "typescript": "^5.9.3"
29
29
  },
30
30
  "exports": {