@principal-ai/principal-view-core 0.24.1 → 0.24.2

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 (38) hide show
  1. package/dist/index.d.ts +8 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +8 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/orchestration/TraceOrchestrator.d.ts +63 -0
  6. package/dist/orchestration/TraceOrchestrator.d.ts.map +1 -0
  7. package/dist/orchestration/TraceOrchestrator.js +346 -0
  8. package/dist/orchestration/TraceOrchestrator.js.map +1 -0
  9. package/dist/parsers/OtlpTraceParser.d.ts +131 -0
  10. package/dist/parsers/OtlpTraceParser.d.ts.map +1 -0
  11. package/dist/parsers/OtlpTraceParser.js +306 -0
  12. package/dist/parsers/OtlpTraceParser.js.map +1 -0
  13. package/dist/registry/CompositeRegistry.d.ts +65 -0
  14. package/dist/registry/CompositeRegistry.d.ts.map +1 -0
  15. package/dist/registry/CompositeRegistry.js +106 -0
  16. package/dist/registry/CompositeRegistry.js.map +1 -0
  17. package/dist/registry/LocalRegistry.d.ts +69 -0
  18. package/dist/registry/LocalRegistry.d.ts.map +1 -0
  19. package/dist/registry/LocalRegistry.js +204 -0
  20. package/dist/registry/LocalRegistry.js.map +1 -0
  21. package/dist/registry/RemoteRegistry.d.ts +84 -0
  22. package/dist/registry/RemoteRegistry.d.ts.map +1 -0
  23. package/dist/registry/RemoteRegistry.js +277 -0
  24. package/dist/registry/RemoteRegistry.js.map +1 -0
  25. package/dist/types/registered-trace.d.ts +247 -155
  26. package/dist/types/registered-trace.d.ts.map +1 -1
  27. package/dist/types/registered-trace.js +8 -1
  28. package/dist/types/registered-trace.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/index.ts +23 -1
  31. package/src/orchestration/TraceOrchestrator.ts +500 -0
  32. package/src/orchestration/__tests__/TraceOrchestrator.test.ts +1087 -0
  33. package/src/parsers/OtlpTraceParser.ts +401 -0
  34. package/src/parsers/__tests__/OtlpTraceParser.test.ts +197 -0
  35. package/src/registry/CompositeRegistry.ts +137 -0
  36. package/src/registry/LocalRegistry.ts +263 -0
  37. package/src/registry/RemoteRegistry.ts +367 -0
  38. package/src/types/registered-trace.ts +282 -195
package/dist/index.d.ts CHANGED
@@ -23,7 +23,14 @@ export type { TemplateSegment, TemplateContext, TemplateValue } from './workflow
23
23
  export { selectScenario, getRequiredEvents, hasEventMatching, computeAggregates, getNestedValue, setNestedValue, } from './workflow/scenario-matcher';
24
24
  export type { WorkflowTemplate, WorkflowScenario, WorkflowMode, ScenarioTemplate, FlowDirective, LogTemplates, FormattingOptions, OtelEvent, OtelSignal, WorkflowContext, WorkflowResult, ScenarioMatchResult, ScenarioMatchDetail, EnhancedScenarioMatchResult, WorkflowMatch, SpanTreeNode, } from './workflow/types';
25
25
  export type { OtelExportTraceServiceRequest, OtelResourceSpansData, OtelScopeSpans, OtelSpanData, OtelResourceData, OtelKeyValue, OtelAnyValue, OtelSpanEvent, OtelLink, OtelSpanStatus, OtelInstrumentationScope, TraceInfo, WorkflowMatchInfo, OtelAttributes, OtelAttributeValue, OtelLog, OtelSpan, OtelResource, OtelSeverity, OtelSeverityText, OtelSeverityNumber, } from './types/otel';
26
- export type { RegisteredTrace, RegistryLookupResult, StoryboardRegistryInterface, TraceRegistryMatcher, } from './types/registered-trace';
26
+ export type { RegisteredTrace, TraceResource, MatchedSpan, ScenarioMatch, OrphanedSpan, StoryboardMatch, UnmatchedSpan, UnmatchedSpans, ValidationIssue, StoryboardRegistryInterface, TraceRegistryMatcher, Resource, Scope, } from './types/registered-trace';
27
+ export { OtlpTraceParser } from './parsers/OtlpTraceParser';
28
+ export type { ExtractedSpan, ExtractedEvent } from './parsers/OtlpTraceParser';
29
+ export { RemoteRegistry } from './registry/RemoteRegistry';
30
+ export { LocalRegistry } from './registry/LocalRegistry';
31
+ export { CompositeRegistry } from './registry/CompositeRegistry';
32
+ export { TraceOrchestrator } from './orchestration/TraceOrchestrator';
33
+ export type { TraceOrchestratorConfig } from './orchestration/TraceOrchestrator';
27
34
  export { getAttributeStringValue, findAttribute, getAttributeValue, flattenResourceAttributes, parseNanoTime, getSpanDuration, isErrorSeverity, isWarnSeverity, } from './types/otel';
28
35
  export type { VersionIdentifier, VersionSnapshot, RegisterVersionRequest, GetVersionResponse, VersionRegistry, } from './types/version-registry';
29
36
  export { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './registry/VersionRegistry';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAG7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGxF,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACtF,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC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BAA8B,CAAC;AAChE,YAAY,EACV,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,YAAY,EACZ,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC"}
package/dist/index.js CHANGED
@@ -20,6 +20,14 @@ export { parseYaml, isYamlFile, getConfigNameFromFilename } from './utils/YamlPa
20
20
  export { renderWorkflow } from './workflow/template-renderer';
21
21
  export { parseTemplate, ParsedTemplate } from './workflow/template-parser';
22
22
  export { selectScenario, getRequiredEvents, hasEventMatching, computeAggregates, getNestedValue, setNestedValue, } from './workflow/scenario-matcher';
23
+ // Export OTLP trace parser
24
+ export { OtlpTraceParser } from './parsers/OtlpTraceParser';
25
+ // Export storyboard registries
26
+ export { RemoteRegistry } from './registry/RemoteRegistry';
27
+ export { LocalRegistry } from './registry/LocalRegistry';
28
+ export { CompositeRegistry } from './registry/CompositeRegistry';
29
+ // Export trace orchestrator
30
+ export { TraceOrchestrator } from './orchestration/TraceOrchestrator';
23
31
  // Export OTEL helper functions
24
32
  export { getAttributeStringValue, findAttribute, getAttributeValue, flattenResourceAttributes, parseNanoTime, getSpanDuration, isErrorSeverity, isWarnSeverity, } from './types/otel';
25
33
  export { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './registry/VersionRegistry';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GAS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BAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAehE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,4FAA4F;AAC5F,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,mDAAmD;AACnD,oDAAoD;AACpD,+DAA+D;AAC/D,0FAA0F;AAC1F,uDAAuD;AACvD,8CAA8C;AAC9C,qEAAqE;AACrE,gEAAgE;AAChE,EAAE;AACF,wGAAwG;AACxG,sGAAsG;AACtG,sEAAsE;AACtE,uEAAuE"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * TraceOrchestrator - Coordinates the complete trace matching pipeline
3
+ *
4
+ * Pipeline:
5
+ * 1. Parse OTLP trace → extract resources and scopes
6
+ * 2. For each scope → lookup VersionSnapshot from registry
7
+ * 3. Match spans against workflows/scenarios
8
+ * 4. Categorize results into three categories
9
+ */
10
+ import type { OtelExportTraceServiceRequest } from '../types/otel';
11
+ import type { RegisteredTrace, StoryboardRegistryInterface } from '../types/registered-trace';
12
+ /**
13
+ * Orchestrator configuration
14
+ */
15
+ export interface TraceOrchestratorConfig {
16
+ registry: StoryboardRegistryInterface;
17
+ enableValidation?: boolean;
18
+ }
19
+ /**
20
+ * Main orchestrator for trace matching
21
+ */
22
+ export declare class TraceOrchestrator {
23
+ private config;
24
+ private parser;
25
+ constructor(config: TraceOrchestratorConfig);
26
+ /**
27
+ * Process an OTLP trace through the complete matching pipeline
28
+ */
29
+ processTrace(otlpData: OtelExportTraceServiceRequest): Promise<RegisteredTrace>;
30
+ /**
31
+ * Lookup storyboards from registry for each scope
32
+ */
33
+ private lookupStoryboardsForScopes;
34
+ /**
35
+ * Extract all spans with their scope information
36
+ */
37
+ private extractAllSpans;
38
+ /**
39
+ * Match spans against storyboards and categorize results
40
+ */
41
+ private matchSpans;
42
+ /**
43
+ * Type guard to check if storyboard has content loaded
44
+ */
45
+ private isStoryboardWithContent;
46
+ /**
47
+ * Convert ScopeSpan to OtelSpanData format
48
+ */
49
+ private convertToOtelSpan;
50
+ /**
51
+ * Try to match a span that matched canvas nodes against workflows
52
+ */
53
+ private matchWorkflowsForSpan;
54
+ /**
55
+ * Type guard to check if workflow has content loaded
56
+ */
57
+ private isWorkflowWithContent;
58
+ /**
59
+ * Validate matches for common issues
60
+ */
61
+ private validateMatches;
62
+ }
63
+ //# sourceMappingURL=TraceOrchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TraceOrchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestration/TraceOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAgB,MAAM,eAAe,CAAC;AACjF,OAAO,KAAK,EACV,eAAe,EACf,2BAA2B,EAS5B,MAAM,2BAA2B,CAAC;AAyCnC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,MAAM,CAAkB;gBAEZ,MAAM,EAAE,uBAAuB;IAInD;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,6BAA6B,GAAG,OAAO,CAAC,eAAe,CAAC;IA0CrF;;OAEG;YACW,0BAA0B;IA6BxC;;OAEG;IACH,OAAO,CAAC,eAAe;IAgCvB;;OAEG;YACW,UAAU;IAmHxB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAM/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;OAEG;YACW,qBAAqB;IAiGnC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;IACH,OAAO,CAAC,eAAe;CAuCxB"}
@@ -0,0 +1,346 @@
1
+ /**
2
+ * TraceOrchestrator - Coordinates the complete trace matching pipeline
3
+ *
4
+ * Pipeline:
5
+ * 1. Parse OTLP trace → extract resources and scopes
6
+ * 2. For each scope → lookup VersionSnapshot from registry
7
+ * 3. Match spans against workflows/scenarios
8
+ * 4. Categorize results into three categories
9
+ */
10
+ import { OtlpTraceParser } from '../parsers/OtlpTraceParser';
11
+ import { SpanMatcher } from '../matchers/SpanMatcher';
12
+ import { selectScenario } from '../workflow/scenario-matcher';
13
+ /**
14
+ * Main orchestrator for trace matching
15
+ */
16
+ export class TraceOrchestrator {
17
+ constructor(config) {
18
+ this.config = config;
19
+ this.parser = new OtlpTraceParser();
20
+ }
21
+ /**
22
+ * Process an OTLP trace through the complete matching pipeline
23
+ */
24
+ async processTrace(otlpData) {
25
+ // Step 1: Parse trace to extract resources and basic info
26
+ const resources = this.parser.extractResources(otlpData);
27
+ const traceInfo = this.parser.extractTraceInfo(otlpData);
28
+ // Step 2: For each scope, lookup storyboards from registry
29
+ const scopeStoryboards = await this.lookupStoryboardsForScopes(resources);
30
+ // Step 3: Extract all spans with scope information
31
+ const allSpans = this.extractAllSpans(otlpData, resources);
32
+ // Step 4: Match spans against storyboards
33
+ const { scenarioMatches, storyboardMatches, unmatchedSpans } = await this.matchSpans(allSpans, scopeStoryboards);
34
+ // Step 5: Validate if enabled
35
+ const validationIssues = this.config.enableValidation
36
+ ? this.validateMatches(scenarioMatches, storyboardMatches)
37
+ : undefined;
38
+ // Step 6: Build final RegisteredTrace
39
+ const registeredTrace = {
40
+ traceId: traceInfo.traceId,
41
+ name: traceInfo.name,
42
+ startTime: traceInfo.startTime,
43
+ endTime: traceInfo.endTime,
44
+ duration: traceInfo.duration,
45
+ spanCount: traceInfo.spanCount,
46
+ hasErrors: traceInfo.hasErrors,
47
+ resources,
48
+ scenarioMatches,
49
+ storyboardMatches,
50
+ unmatchedSpans,
51
+ validationIssues,
52
+ otlpData, // Include original OTLP data
53
+ };
54
+ return registeredTrace;
55
+ }
56
+ /**
57
+ * Lookup storyboards from registry for each scope
58
+ */
59
+ async lookupStoryboardsForScopes(resources) {
60
+ const results = [];
61
+ for (const resource of resources) {
62
+ for (const scopeInfo of resource.scopes) {
63
+ const snapshot = await this.config.registry.lookupByScope({
64
+ name: scopeInfo.scope.name,
65
+ version: scopeInfo.scope.version,
66
+ }, {
67
+ attributes: resource.attributes,
68
+ });
69
+ results.push({
70
+ scopeName: scopeInfo.scope.name,
71
+ scopeVersion: scopeInfo.scope.version,
72
+ snapshot,
73
+ spanIds: scopeInfo.spanIds,
74
+ });
75
+ }
76
+ }
77
+ return results;
78
+ }
79
+ /**
80
+ * Extract all spans with their scope information
81
+ */
82
+ extractAllSpans(otlpData, resources) {
83
+ const spans = [];
84
+ for (const resource of resources) {
85
+ for (const scopeInfo of resource.scopes) {
86
+ const scopeSpans = this.parser.getSpansForScope(otlpData, scopeInfo.scope.name);
87
+ for (const span of scopeSpans) {
88
+ spans.push({
89
+ scopeName: scopeInfo.scope.name,
90
+ scopeVersion: scopeInfo.scope.version,
91
+ spanId: span.spanId,
92
+ spanName: span.spanName,
93
+ traceId: span.traceId,
94
+ parentSpanId: span.parentSpanId,
95
+ startTime: span.startTime,
96
+ endTime: span.endTime,
97
+ duration: span.duration,
98
+ attributes: span.attributes,
99
+ events: span.events,
100
+ status: span.status,
101
+ });
102
+ }
103
+ }
104
+ }
105
+ return spans;
106
+ }
107
+ /**
108
+ * Match spans against storyboards and categorize results
109
+ */
110
+ async matchSpans(spans, scopeStoryboards) {
111
+ const scenarioMatches = [];
112
+ const storyboardMatches = [];
113
+ const unmatchedSpansList = [];
114
+ const matchedSpanIds = new Set();
115
+ // For each scope with storyboards
116
+ for (const scopeWithStoryboards of scopeStoryboards) {
117
+ if (!scopeWithStoryboards.snapshot) {
118
+ // No storyboards found → all spans are unmatched
119
+ const scopeSpans = spans.filter((s) => s.scopeName === scopeWithStoryboards.scopeName);
120
+ for (const span of scopeSpans) {
121
+ unmatchedSpansList.push({
122
+ spanId: span.spanId,
123
+ spanName: span.spanName,
124
+ scopeName: span.scopeName,
125
+ timestamp: span.startTime,
126
+ duration: span.duration,
127
+ reason: 'No storyboards found for scope',
128
+ attributes: span.attributes,
129
+ });
130
+ // Mark as processed so we don't add it again in the final loop
131
+ matchedSpanIds.add(span.spanId);
132
+ }
133
+ continue;
134
+ }
135
+ // Get spans for this scope
136
+ const scopeSpans = spans.filter((s) => s.scopeName === scopeWithStoryboards.scopeName);
137
+ // Match against each storyboard
138
+ for (const storyboard of scopeWithStoryboards.snapshot.storyboards) {
139
+ // Validate that content is loaded
140
+ if (!this.isStoryboardWithContent(storyboard)) {
141
+ console.error('[TraceOrchestrator] Storyboard content not loaded:', storyboard.id);
142
+ continue;
143
+ }
144
+ // Get canvas content
145
+ const canvas = storyboard.canvas; // Will be DiscoveredCanvasWithContent
146
+ if (!canvas.content) {
147
+ console.error('[TraceOrchestrator] Canvas content not loaded:', storyboard.id);
148
+ continue;
149
+ }
150
+ // Create SpanMatcher for this canvas
151
+ const spanMatcher = new SpanMatcher(canvas.content);
152
+ // Match each span against the canvas
153
+ for (const span of scopeSpans) {
154
+ // Convert ScopeSpan to OtelSpanData format for SpanMatcher
155
+ const otelSpan = this.convertToOtelSpan(span);
156
+ const resource = { attributes: [] }; // Resource matching happens at scope level
157
+ const matchResult = spanMatcher.matchSpan(otelSpan, resource);
158
+ if (matchResult.matchedNodeIds.length > 0) {
159
+ // This span matched canvas nodes! Now try workflow/scenario matching
160
+ const workflowMatch = await this.matchWorkflowsForSpan(span, matchResult.matchedNodeIds, storyboard, scopeWithStoryboards.scopeName);
161
+ if (workflowMatch) {
162
+ matchedSpanIds.add(span.spanId);
163
+ if (workflowMatch.type === 'scenario') {
164
+ scenarioMatches.push(workflowMatch.match);
165
+ }
166
+ else {
167
+ storyboardMatches.push(workflowMatch.match);
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ // Collect unmatched spans (spans that didn't match any workflow)
175
+ for (const span of spans) {
176
+ if (!matchedSpanIds.has(span.spanId)) {
177
+ const scopeHasStoryboards = scopeStoryboards.some((s) => s.scopeName === span.scopeName && s.snapshot !== null);
178
+ unmatchedSpansList.push({
179
+ spanId: span.spanId,
180
+ spanName: span.spanName,
181
+ scopeName: span.scopeName,
182
+ timestamp: span.startTime,
183
+ duration: span.duration,
184
+ reason: scopeHasStoryboards
185
+ ? 'No canvas nodes matched this span'
186
+ : 'No storyboards found for scope',
187
+ attributes: span.attributes,
188
+ });
189
+ }
190
+ }
191
+ const unmatchedSpans = {
192
+ spans: unmatchedSpansList,
193
+ };
194
+ return { scenarioMatches, storyboardMatches, unmatchedSpans };
195
+ }
196
+ /**
197
+ * Type guard to check if storyboard has content loaded
198
+ */
199
+ isStoryboardWithContent(storyboard) {
200
+ return storyboard.canvas?.content !== undefined;
201
+ }
202
+ /**
203
+ * Convert ScopeSpan to OtelSpanData format
204
+ */
205
+ convertToOtelSpan(span) {
206
+ return {
207
+ traceId: span.traceId,
208
+ spanId: span.spanId,
209
+ name: span.spanName,
210
+ parentSpanId: span.parentSpanId,
211
+ kind: 1,
212
+ startTimeUnixNano: String(span.startTime * 1000000),
213
+ endTimeUnixNano: String(span.endTime * 1000000),
214
+ attributes: Object.entries(span.attributes || {}).map(([key, value]) => ({
215
+ key,
216
+ value: { stringValue: String(value) },
217
+ })),
218
+ events: span.events.map((e) => ({
219
+ timeUnixNano: String(e.timestamp * 1000000),
220
+ name: e.name,
221
+ attributes: Object.entries(e.attributes || {}).map(([key, value]) => ({
222
+ key,
223
+ value: { stringValue: String(value) },
224
+ })),
225
+ })),
226
+ status: span.status,
227
+ };
228
+ }
229
+ /**
230
+ * Try to match a span that matched canvas nodes against workflows
231
+ */
232
+ async matchWorkflowsForSpan(span, matchedNodeIds, storyboard, scopeName) {
233
+ // Convert span events to OtelEvent format for scenario matcher
234
+ const otelEvents = span.events.map((e) => ({
235
+ name: e.name,
236
+ timestamp: e.timestamp,
237
+ attributes: e.attributes,
238
+ }));
239
+ // Try each workflow in the storyboard
240
+ for (const workflow of storyboard.workflows) {
241
+ // Validate that workflow has content loaded
242
+ if (!this.isWorkflowWithContent(workflow)) {
243
+ console.error('[TraceOrchestrator] Workflow content not loaded:', workflow.id);
244
+ continue;
245
+ }
246
+ // Try to match scenario using scenario matcher
247
+ const scenarioMatchResult = selectScenario(workflow.content, otelEvents);
248
+ // Check if we have a recommended match with actual coverage
249
+ // We only consider it a scenario match if there's meaningful overlap
250
+ if (scenarioMatchResult.recommendedScenario &&
251
+ scenarioMatchResult.recommendedScenario.matchPercentage > 0) {
252
+ const detail = scenarioMatchResult.recommendedScenario;
253
+ // Category 1: Scenario Match
254
+ // For each matched node, create a MatchedSpan
255
+ const matchedSpans = matchedNodeIds.map((nodeId) => ({
256
+ spanId: span.spanId,
257
+ spanName: span.spanName,
258
+ nodeId,
259
+ timestamp: span.startTime,
260
+ duration: span.duration,
261
+ events: detail.matchedEventNames,
262
+ attributes: span.attributes,
263
+ matchConfidence: 'exact',
264
+ }));
265
+ return {
266
+ type: 'scenario',
267
+ match: {
268
+ storyboardId: storyboard.id,
269
+ scenarioId: detail.scenario.id,
270
+ scopeName,
271
+ matchedSpans,
272
+ coveragePercent: detail.matchPercentage,
273
+ matchType: detail.matchPercentage === 100 ? 'full' : 'partial',
274
+ },
275
+ };
276
+ }
277
+ else {
278
+ // No scenario matched - create orphaned span
279
+ // Category 2: Storyboard Match (canvas matched, but scenario didn't)
280
+ const orphanedSpans = matchedNodeIds.map((nodeId) => ({
281
+ spanId: span.spanId,
282
+ spanName: span.spanName,
283
+ nodeId,
284
+ timestamp: span.startTime,
285
+ duration: span.duration,
286
+ reason: 'No scenario matched the observed events',
287
+ observedEvents: span.events.map((e) => e.name),
288
+ expectedEvents: workflow.content.scenarios.flatMap((s) => Object.keys(s.template.events || {})),
289
+ attributes: span.attributes,
290
+ }));
291
+ return {
292
+ type: 'storyboard',
293
+ match: {
294
+ storyboardId: storyboard.id,
295
+ scopeName,
296
+ orphanedSpans,
297
+ },
298
+ };
299
+ }
300
+ }
301
+ return null; // No workflow matched
302
+ }
303
+ /**
304
+ * Type guard to check if workflow has content loaded
305
+ */
306
+ isWorkflowWithContent(workflow) {
307
+ return workflow.content !== undefined;
308
+ }
309
+ /**
310
+ * Validate matches for common issues
311
+ */
312
+ validateMatches(scenarioMatches, storyboardMatches) {
313
+ const issues = [];
314
+ // Check for duplicate scenario matches
315
+ const scenarioKeys = new Set();
316
+ for (const match of scenarioMatches) {
317
+ const key = `${match.storyboardId}:${match.scenarioId}:${match.scopeName}`;
318
+ if (scenarioKeys.has(key)) {
319
+ issues.push({
320
+ level: 'warning',
321
+ category: 'matching',
322
+ message: `Duplicate scenario match detected for scope ${match.scopeName}`,
323
+ spanId: match.matchedSpans[0]?.spanId,
324
+ scopeName: match.scopeName,
325
+ });
326
+ }
327
+ scenarioKeys.add(key);
328
+ }
329
+ // Check for orphaned spans with no clear reason
330
+ for (const match of storyboardMatches) {
331
+ for (const orphan of match.orphanedSpans) {
332
+ if (!orphan.reason || orphan.reason.trim() === '') {
333
+ issues.push({
334
+ level: 'warning',
335
+ category: 'matching',
336
+ message: 'Orphaned span has no reason',
337
+ spanId: orphan.spanId,
338
+ scopeName: match.scopeName,
339
+ });
340
+ }
341
+ }
342
+ }
343
+ return issues;
344
+ }
345
+ }
346
+ //# sourceMappingURL=TraceOrchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TraceOrchestrator.js","sourceRoot":"","sources":["../../src/orchestration/TraceOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CA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EAAE,6BAA6B;wBACtC,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,CAAC,CAAC;iBACJ;aACF;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * OTLP Trace Parser
3
+ *
4
+ * Extracts structured data from OTLP traces for scope-based matching.
5
+ *
6
+ * Responsibilities:
7
+ * - Extract resources (service info, attributes)
8
+ * - Extract scopes (instrumentation libraries)
9
+ * - Map spans to their scopes
10
+ * - Extract span events
11
+ * - Convert OTLP timestamps and IDs to usable formats
12
+ */
13
+ import type { OtelExportTraceServiceRequest, OtelSpanEvent, OtelKeyValue } from '../types/otel';
14
+ import type { TraceResource } from '../types/registered-trace';
15
+ /**
16
+ * Extracted span information
17
+ */
18
+ export interface ExtractedSpan {
19
+ spanId: string;
20
+ spanName: string;
21
+ parentSpanId?: string;
22
+ traceId: string;
23
+ startTime: number;
24
+ endTime: number;
25
+ duration: number;
26
+ attributes: Record<string, unknown>;
27
+ events: ExtractedEvent[];
28
+ status: {
29
+ code: number;
30
+ message?: string;
31
+ };
32
+ scopeName: string;
33
+ }
34
+ /**
35
+ * Extracted event information
36
+ */
37
+ export interface ExtractedEvent {
38
+ name: string;
39
+ timestamp: number;
40
+ attributes: Record<string, unknown>;
41
+ }
42
+ /**
43
+ * Parser for OTLP traces
44
+ */
45
+ export declare class OtlpTraceParser {
46
+ /**
47
+ * Extract all resources from OTLP trace
48
+ *
49
+ * Returns array of resources, each with their scopes and span mappings.
50
+ */
51
+ extractResources(otlpData: OtelExportTraceServiceRequest): TraceResource[];
52
+ /**
53
+ * Extract single resource
54
+ */
55
+ private extractResource;
56
+ /**
57
+ * Extract service identifier for routing
58
+ *
59
+ * Priority: dev.server.url > service.name
60
+ */
61
+ private extractServiceIdentifier;
62
+ /**
63
+ * Extract all scopes from scopeSpans
64
+ */
65
+ private extractScopes;
66
+ /**
67
+ * Get all spans for a specific scope
68
+ */
69
+ getSpansForScope(otlpData: OtelExportTraceServiceRequest, scopeName: string): ExtractedSpan[];
70
+ /**
71
+ * Extract span information
72
+ */
73
+ private extractSpan;
74
+ /**
75
+ * Extract events from span
76
+ */
77
+ extractEvents(events: OtelSpanEvent[]): ExtractedEvent[];
78
+ /**
79
+ * Extract basic trace information
80
+ */
81
+ extractTraceInfo(otlpData: OtelExportTraceServiceRequest): {
82
+ traceId: string;
83
+ name: string;
84
+ startTime: number;
85
+ endTime: number;
86
+ duration: number;
87
+ spanCount: number;
88
+ hasErrors: boolean;
89
+ };
90
+ /**
91
+ * Extract trace ID
92
+ */
93
+ private extractTraceId;
94
+ /**
95
+ * Extract trace name (root span name)
96
+ */
97
+ private extractTraceName;
98
+ /**
99
+ * Extract time range across all spans
100
+ */
101
+ private extractTimeRange;
102
+ /**
103
+ * Count total spans
104
+ */
105
+ private countSpans;
106
+ /**
107
+ * Detect if any span has errors
108
+ */
109
+ private detectErrors;
110
+ /**
111
+ * Get all spans from trace (flattened)
112
+ */
113
+ private getAllSpans;
114
+ /**
115
+ * Convert OTLP attributes to simple key-value record
116
+ */
117
+ convertAttributes(attrs: OtelKeyValue[]): Record<string, unknown>;
118
+ /**
119
+ * Extract value from OTLP AnyValue
120
+ */
121
+ private extractAttributeValue;
122
+ /**
123
+ * Convert nanoseconds to milliseconds
124
+ */
125
+ private nanoToMillis;
126
+ /**
127
+ * Check if trace is in local development mode
128
+ */
129
+ isLocalDevelopment(otlpData: OtelExportTraceServiceRequest): boolean;
130
+ }
131
+ //# sourceMappingURL=OtlpTraceParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OtlpTraceParser.d.ts","sourceRoot":"","sources":["../../src/parsers/OtlpTraceParser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAI7B,aAAa,EACb,YAAY,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,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