@tracelens/shared 0.1.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/dist/__tests__/validation.test.d.ts +2 -0
- package/dist/__tests__/validation.test.d.ts.map +1 -0
- package/dist/__tests__/validation.test.js +16 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/schemas/dependency.schema.d.ts +177 -0
- package/dist/schemas/dependency.schema.d.ts.map +1 -0
- package/dist/schemas/dependency.schema.js +187 -0
- package/dist/schemas/error.schema.d.ts +170 -0
- package/dist/schemas/error.schema.d.ts.map +1 -0
- package/dist/schemas/error.schema.js +176 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +5 -0
- package/dist/schemas/performance.schema.d.ts +333 -0
- package/dist/schemas/performance.schema.d.ts.map +1 -0
- package/dist/schemas/performance.schema.js +200 -0
- package/dist/schemas/trace.schema.d.ts +325 -0
- package/dist/schemas/trace.schema.d.ts.map +1 -0
- package/dist/schemas/trace.schema.js +145 -0
- package/dist/types/dependency.types.d.ts +109 -0
- package/dist/types/dependency.types.d.ts.map +1 -0
- package/dist/types/dependency.types.js +8 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/performance.types.d.ts +95 -0
- package/dist/types/performance.types.d.ts.map +1 -0
- package/dist/types/performance.types.js +1 -0
- package/dist/types/security.types.d.ts +154 -0
- package/dist/types/security.types.d.ts.map +1 -0
- package/dist/types/security.types.js +8 -0
- package/dist/types/trace.types.d.ts +57 -0
- package/dist/types/trace.types.d.ts.map +1 -0
- package/dist/types/trace.types.js +20 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/validation.d.ts +21 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +157 -0
- package/jest.config.js +14 -0
- package/package.json +22 -0
- package/src/__tests__/validation.test.ts +19 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.ts +4 -0
- package/src/schemas/dependency.schema.ts +187 -0
- package/src/schemas/error.schema.ts +176 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/performance.schema.ts +200 -0
- package/src/schemas/trace.schema.ts +146 -0
- package/src/types/dependency.types.ts +120 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.ts +11 -0
- package/src/types/performance.types.ts +108 -0
- package/src/types/security.types.ts +172 -0
- package/src/types/trace.types.ts +62 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/validation.ts +209 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Performance timing event schema for TraceLens
|
|
2
|
+
export const PerformanceEventSchema = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
required: ['id', 'timestamp', 'type', 'data', 'url', 'userAgent'],
|
|
5
|
+
properties: {
|
|
6
|
+
id: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
pattern: '^[a-zA-Z0-9_-]+$',
|
|
9
|
+
minLength: 1,
|
|
10
|
+
maxLength: 100
|
|
11
|
+
},
|
|
12
|
+
timestamp: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
minimum: 1577836800000, // 2020-01-01
|
|
15
|
+
maximum: 2524608000000 // 2050-01-01
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['web-vitals', 'resource-timing', 'navigation-timing', 'long-task']
|
|
20
|
+
},
|
|
21
|
+
data: {
|
|
22
|
+
oneOf: [
|
|
23
|
+
{ $ref: '#/definitions/WebVitalsData' },
|
|
24
|
+
{ $ref: '#/definitions/ResourceTimingData' },
|
|
25
|
+
{ $ref: '#/definitions/NavigationTimingData' },
|
|
26
|
+
{ $ref: '#/definitions/LongTaskData' }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
url: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
format: 'uri',
|
|
32
|
+
maxLength: 2048
|
|
33
|
+
},
|
|
34
|
+
userAgent: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
maxLength: 512
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
definitions: {
|
|
40
|
+
WebVitalsData: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
cls: { $ref: '#/definitions/CLSMetric' },
|
|
44
|
+
fid: { $ref: '#/definitions/FIDMetric' },
|
|
45
|
+
lcp: { $ref: '#/definitions/LCPMetric' },
|
|
46
|
+
fcp: { $ref: '#/definitions/FCPMetric' },
|
|
47
|
+
ttfb: { $ref: '#/definitions/TTFBMetric' },
|
|
48
|
+
inp: { $ref: '#/definitions/INPMetric' }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
BaseMetric: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
required: ['name', 'value', 'rating', 'delta', 'id', 'navigationType'],
|
|
54
|
+
properties: {
|
|
55
|
+
name: { type: 'string' },
|
|
56
|
+
value: { type: 'number', minimum: 0 },
|
|
57
|
+
rating: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
enum: ['good', 'needs-improvement', 'poor']
|
|
60
|
+
},
|
|
61
|
+
delta: { type: 'number' },
|
|
62
|
+
id: { type: 'string' },
|
|
63
|
+
navigationType: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
enum: ['navigate', 'reload', 'back-forward', 'prerender']
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
CLSMetric: {
|
|
70
|
+
allOf: [
|
|
71
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
72
|
+
{
|
|
73
|
+
properties: {
|
|
74
|
+
name: { const: 'CLS' },
|
|
75
|
+
value: { maximum: 1 }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
FIDMetric: {
|
|
81
|
+
allOf: [
|
|
82
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
83
|
+
{
|
|
84
|
+
properties: {
|
|
85
|
+
name: { const: 'FID' },
|
|
86
|
+
value: { maximum: 10000 }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
LCPMetric: {
|
|
92
|
+
allOf: [
|
|
93
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
94
|
+
{
|
|
95
|
+
properties: {
|
|
96
|
+
name: { const: 'LCP' },
|
|
97
|
+
value: { maximum: 30000 }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
FCPMetric: {
|
|
103
|
+
allOf: [
|
|
104
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
105
|
+
{
|
|
106
|
+
properties: {
|
|
107
|
+
name: { const: 'FCP' },
|
|
108
|
+
value: { maximum: 10000 }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
TTFBMetric: {
|
|
114
|
+
allOf: [
|
|
115
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
116
|
+
{
|
|
117
|
+
properties: {
|
|
118
|
+
name: { const: 'TTFB' },
|
|
119
|
+
value: { maximum: 5000 }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
INPMetric: {
|
|
125
|
+
allOf: [
|
|
126
|
+
{ $ref: '#/definitions/BaseMetric' },
|
|
127
|
+
{
|
|
128
|
+
properties: {
|
|
129
|
+
name: { const: 'INP' },
|
|
130
|
+
value: { maximum: 1000 }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
ResourceTimingData: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
required: ['name', 'entryType', 'startTime', 'duration'],
|
|
138
|
+
properties: {
|
|
139
|
+
name: { type: 'string', maxLength: 2048 },
|
|
140
|
+
entryType: { const: 'resource' },
|
|
141
|
+
startTime: { type: 'number', minimum: 0 },
|
|
142
|
+
duration: { type: 'number', minimum: 0 },
|
|
143
|
+
initiatorType: { type: 'string' },
|
|
144
|
+
nextHopProtocol: { type: 'string' },
|
|
145
|
+
renderBlockingStatus: { type: 'string' },
|
|
146
|
+
responseStatus: { type: 'number', minimum: 100, maximum: 599 },
|
|
147
|
+
transferSize: { type: 'number', minimum: 0 },
|
|
148
|
+
encodedBodySize: { type: 'number', minimum: 0 },
|
|
149
|
+
decodedBodySize: { type: 'number', minimum: 0 },
|
|
150
|
+
responseStart: { type: 'number', minimum: 0 },
|
|
151
|
+
responseEnd: { type: 'number', minimum: 0 }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
NavigationTimingData: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
required: ['type'],
|
|
157
|
+
properties: {
|
|
158
|
+
domComplete: { type: 'number', minimum: 0 },
|
|
159
|
+
domContentLoadedEventEnd: { type: 'number', minimum: 0 },
|
|
160
|
+
domContentLoadedEventStart: { type: 'number', minimum: 0 },
|
|
161
|
+
domInteractive: { type: 'number', minimum: 0 },
|
|
162
|
+
loadEventEnd: { type: 'number', minimum: 0 },
|
|
163
|
+
loadEventStart: { type: 'number', minimum: 0 },
|
|
164
|
+
redirectCount: { type: 'number', minimum: 0 },
|
|
165
|
+
type: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
enum: ['navigate', 'reload', 'back-forward', 'prerender']
|
|
168
|
+
},
|
|
169
|
+
unloadEventEnd: { type: 'number', minimum: 0 },
|
|
170
|
+
unloadEventStart: { type: 'number', minimum: 0 }
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
LongTaskData: {
|
|
174
|
+
type: 'object',
|
|
175
|
+
required: ['name', 'entryType', 'startTime', 'duration'],
|
|
176
|
+
properties: {
|
|
177
|
+
name: { const: 'longtask' },
|
|
178
|
+
entryType: { const: 'longtask' },
|
|
179
|
+
startTime: { type: 'number', minimum: 0 },
|
|
180
|
+
duration: { type: 'number', minimum: 50 }, // Long tasks are >= 50ms
|
|
181
|
+
attribution: {
|
|
182
|
+
type: 'array',
|
|
183
|
+
items: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {
|
|
186
|
+
name: { type: 'string' },
|
|
187
|
+
entryType: { const: 'taskattribution' },
|
|
188
|
+
startTime: { type: 'number', minimum: 0 },
|
|
189
|
+
duration: { type: 'number', minimum: 0 },
|
|
190
|
+
containerType: { type: 'string' },
|
|
191
|
+
containerSrc: { type: 'string' },
|
|
192
|
+
containerId: { type: 'string' },
|
|
193
|
+
containerName: { type: 'string' }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
export declare const TraceSpanSchema: {
|
|
2
|
+
readonly type: "object";
|
|
3
|
+
readonly required: readonly ["traceId", "spanId", "operationName", "startTime", "tags", "status"];
|
|
4
|
+
readonly properties: {
|
|
5
|
+
readonly traceId: {
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
readonly pattern: "^[a-f0-9]{32}$";
|
|
8
|
+
readonly description: "Hexadecimal trace ID (32 characters)";
|
|
9
|
+
};
|
|
10
|
+
readonly spanId: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
13
|
+
readonly description: "Hexadecimal span ID (16 characters)";
|
|
14
|
+
};
|
|
15
|
+
readonly parentSpanId: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
18
|
+
readonly description: "Hexadecimal parent span ID (16 characters)";
|
|
19
|
+
};
|
|
20
|
+
readonly operationName: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly minLength: 1;
|
|
23
|
+
readonly maxLength: 256;
|
|
24
|
+
readonly description: "Name of the operation being traced";
|
|
25
|
+
};
|
|
26
|
+
readonly startTime: {
|
|
27
|
+
readonly type: "number";
|
|
28
|
+
readonly minimum: 0;
|
|
29
|
+
readonly description: "Start time in microseconds since epoch";
|
|
30
|
+
};
|
|
31
|
+
readonly endTime: {
|
|
32
|
+
readonly type: "number";
|
|
33
|
+
readonly minimum: 0;
|
|
34
|
+
readonly description: "End time in microseconds since epoch";
|
|
35
|
+
};
|
|
36
|
+
readonly duration: {
|
|
37
|
+
readonly type: "number";
|
|
38
|
+
readonly minimum: 0;
|
|
39
|
+
readonly description: "Duration in microseconds";
|
|
40
|
+
};
|
|
41
|
+
readonly tags: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly patternProperties: {
|
|
44
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
45
|
+
readonly oneOf: readonly [{
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly maxLength: 1024;
|
|
48
|
+
}, {
|
|
49
|
+
readonly type: "number";
|
|
50
|
+
}, {
|
|
51
|
+
readonly type: "boolean";
|
|
52
|
+
}];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
readonly description: "Key-value pairs providing additional context";
|
|
57
|
+
};
|
|
58
|
+
readonly logs: {
|
|
59
|
+
readonly type: "array";
|
|
60
|
+
readonly items: {
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly required: readonly ["timestamp", "fields"];
|
|
63
|
+
readonly properties: {
|
|
64
|
+
readonly timestamp: {
|
|
65
|
+
readonly type: "number";
|
|
66
|
+
readonly minimum: 0;
|
|
67
|
+
readonly description: "Log timestamp in microseconds since epoch";
|
|
68
|
+
};
|
|
69
|
+
readonly fields: {
|
|
70
|
+
readonly type: "object";
|
|
71
|
+
readonly patternProperties: {
|
|
72
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
73
|
+
readonly oneOf: readonly [{
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly maxLength: 1024;
|
|
76
|
+
}, {
|
|
77
|
+
readonly type: "number";
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "boolean";
|
|
80
|
+
}];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly additionalProperties: false;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly maxItems: 100;
|
|
88
|
+
readonly description: "Structured log events within the span";
|
|
89
|
+
};
|
|
90
|
+
readonly status: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly enum: readonly ["OK", "CANCELLED", "UNKNOWN", "INVALID_ARGUMENT", "DEADLINE_EXCEEDED", "NOT_FOUND", "ALREADY_EXISTS", "PERMISSION_DENIED", "RESOURCE_EXHAUSTED", "FAILED_PRECONDITION", "ABORTED", "OUT_OF_RANGE", "UNIMPLEMENTED", "INTERNAL", "UNAVAILABLE", "DATA_LOSS", "UNAUTHENTICATED"];
|
|
93
|
+
readonly description: "Span status indicating success or failure";
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
readonly additionalProperties: false;
|
|
97
|
+
};
|
|
98
|
+
export declare const TraceSchema: {
|
|
99
|
+
readonly type: "object";
|
|
100
|
+
readonly required: readonly ["traceId", "spans", "startTime"];
|
|
101
|
+
readonly properties: {
|
|
102
|
+
readonly traceId: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly pattern: "^[a-f0-9]{32}$";
|
|
105
|
+
readonly description: "Hexadecimal trace ID (32 characters)";
|
|
106
|
+
};
|
|
107
|
+
readonly spans: {
|
|
108
|
+
readonly type: "array";
|
|
109
|
+
readonly items: {
|
|
110
|
+
readonly type: "object";
|
|
111
|
+
readonly required: readonly ["traceId", "spanId", "operationName", "startTime", "tags", "status"];
|
|
112
|
+
readonly properties: {
|
|
113
|
+
readonly traceId: {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly pattern: "^[a-f0-9]{32}$";
|
|
116
|
+
readonly description: "Hexadecimal trace ID (32 characters)";
|
|
117
|
+
};
|
|
118
|
+
readonly spanId: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
121
|
+
readonly description: "Hexadecimal span ID (16 characters)";
|
|
122
|
+
};
|
|
123
|
+
readonly parentSpanId: {
|
|
124
|
+
readonly type: "string";
|
|
125
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
126
|
+
readonly description: "Hexadecimal parent span ID (16 characters)";
|
|
127
|
+
};
|
|
128
|
+
readonly operationName: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
readonly minLength: 1;
|
|
131
|
+
readonly maxLength: 256;
|
|
132
|
+
readonly description: "Name of the operation being traced";
|
|
133
|
+
};
|
|
134
|
+
readonly startTime: {
|
|
135
|
+
readonly type: "number";
|
|
136
|
+
readonly minimum: 0;
|
|
137
|
+
readonly description: "Start time in microseconds since epoch";
|
|
138
|
+
};
|
|
139
|
+
readonly endTime: {
|
|
140
|
+
readonly type: "number";
|
|
141
|
+
readonly minimum: 0;
|
|
142
|
+
readonly description: "End time in microseconds since epoch";
|
|
143
|
+
};
|
|
144
|
+
readonly duration: {
|
|
145
|
+
readonly type: "number";
|
|
146
|
+
readonly minimum: 0;
|
|
147
|
+
readonly description: "Duration in microseconds";
|
|
148
|
+
};
|
|
149
|
+
readonly tags: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly patternProperties: {
|
|
152
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
153
|
+
readonly oneOf: readonly [{
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly maxLength: 1024;
|
|
156
|
+
}, {
|
|
157
|
+
readonly type: "number";
|
|
158
|
+
}, {
|
|
159
|
+
readonly type: "boolean";
|
|
160
|
+
}];
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
readonly additionalProperties: false;
|
|
164
|
+
readonly description: "Key-value pairs providing additional context";
|
|
165
|
+
};
|
|
166
|
+
readonly logs: {
|
|
167
|
+
readonly type: "array";
|
|
168
|
+
readonly items: {
|
|
169
|
+
readonly type: "object";
|
|
170
|
+
readonly required: readonly ["timestamp", "fields"];
|
|
171
|
+
readonly properties: {
|
|
172
|
+
readonly timestamp: {
|
|
173
|
+
readonly type: "number";
|
|
174
|
+
readonly minimum: 0;
|
|
175
|
+
readonly description: "Log timestamp in microseconds since epoch";
|
|
176
|
+
};
|
|
177
|
+
readonly fields: {
|
|
178
|
+
readonly type: "object";
|
|
179
|
+
readonly patternProperties: {
|
|
180
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
181
|
+
readonly oneOf: readonly [{
|
|
182
|
+
readonly type: "string";
|
|
183
|
+
readonly maxLength: 1024;
|
|
184
|
+
}, {
|
|
185
|
+
readonly type: "number";
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "boolean";
|
|
188
|
+
}];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
readonly additionalProperties: false;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
readonly maxItems: 100;
|
|
196
|
+
readonly description: "Structured log events within the span";
|
|
197
|
+
};
|
|
198
|
+
readonly status: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
readonly enum: readonly ["OK", "CANCELLED", "UNKNOWN", "INVALID_ARGUMENT", "DEADLINE_EXCEEDED", "NOT_FOUND", "ALREADY_EXISTS", "PERMISSION_DENIED", "RESOURCE_EXHAUSTED", "FAILED_PRECONDITION", "ABORTED", "OUT_OF_RANGE", "UNIMPLEMENTED", "INTERNAL", "UNAVAILABLE", "DATA_LOSS", "UNAUTHENTICATED"];
|
|
201
|
+
readonly description: "Span status indicating success or failure";
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
readonly additionalProperties: false;
|
|
205
|
+
};
|
|
206
|
+
readonly minItems: 1;
|
|
207
|
+
readonly maxItems: 1000;
|
|
208
|
+
readonly description: "Array of spans that make up this trace";
|
|
209
|
+
};
|
|
210
|
+
readonly startTime: {
|
|
211
|
+
readonly type: "number";
|
|
212
|
+
readonly minimum: 0;
|
|
213
|
+
readonly description: "Trace start time in microseconds since epoch";
|
|
214
|
+
};
|
|
215
|
+
readonly endTime: {
|
|
216
|
+
readonly type: "number";
|
|
217
|
+
readonly minimum: 0;
|
|
218
|
+
readonly description: "Trace end time in microseconds since epoch";
|
|
219
|
+
};
|
|
220
|
+
readonly duration: {
|
|
221
|
+
readonly type: "number";
|
|
222
|
+
readonly minimum: 0;
|
|
223
|
+
readonly description: "Total trace duration in microseconds";
|
|
224
|
+
};
|
|
225
|
+
readonly rootSpan: {
|
|
226
|
+
readonly type: "object";
|
|
227
|
+
readonly required: readonly ["traceId", "spanId", "operationName", "startTime", "tags", "status"];
|
|
228
|
+
readonly properties: {
|
|
229
|
+
readonly traceId: {
|
|
230
|
+
readonly type: "string";
|
|
231
|
+
readonly pattern: "^[a-f0-9]{32}$";
|
|
232
|
+
readonly description: "Hexadecimal trace ID (32 characters)";
|
|
233
|
+
};
|
|
234
|
+
readonly spanId: {
|
|
235
|
+
readonly type: "string";
|
|
236
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
237
|
+
readonly description: "Hexadecimal span ID (16 characters)";
|
|
238
|
+
};
|
|
239
|
+
readonly parentSpanId: {
|
|
240
|
+
readonly type: "string";
|
|
241
|
+
readonly pattern: "^[a-f0-9]{16}$";
|
|
242
|
+
readonly description: "Hexadecimal parent span ID (16 characters)";
|
|
243
|
+
};
|
|
244
|
+
readonly operationName: {
|
|
245
|
+
readonly type: "string";
|
|
246
|
+
readonly minLength: 1;
|
|
247
|
+
readonly maxLength: 256;
|
|
248
|
+
readonly description: "Name of the operation being traced";
|
|
249
|
+
};
|
|
250
|
+
readonly startTime: {
|
|
251
|
+
readonly type: "number";
|
|
252
|
+
readonly minimum: 0;
|
|
253
|
+
readonly description: "Start time in microseconds since epoch";
|
|
254
|
+
};
|
|
255
|
+
readonly endTime: {
|
|
256
|
+
readonly type: "number";
|
|
257
|
+
readonly minimum: 0;
|
|
258
|
+
readonly description: "End time in microseconds since epoch";
|
|
259
|
+
};
|
|
260
|
+
readonly duration: {
|
|
261
|
+
readonly type: "number";
|
|
262
|
+
readonly minimum: 0;
|
|
263
|
+
readonly description: "Duration in microseconds";
|
|
264
|
+
};
|
|
265
|
+
readonly tags: {
|
|
266
|
+
readonly type: "object";
|
|
267
|
+
readonly patternProperties: {
|
|
268
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
269
|
+
readonly oneOf: readonly [{
|
|
270
|
+
readonly type: "string";
|
|
271
|
+
readonly maxLength: 1024;
|
|
272
|
+
}, {
|
|
273
|
+
readonly type: "number";
|
|
274
|
+
}, {
|
|
275
|
+
readonly type: "boolean";
|
|
276
|
+
}];
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly additionalProperties: false;
|
|
280
|
+
readonly description: "Key-value pairs providing additional context";
|
|
281
|
+
};
|
|
282
|
+
readonly logs: {
|
|
283
|
+
readonly type: "array";
|
|
284
|
+
readonly items: {
|
|
285
|
+
readonly type: "object";
|
|
286
|
+
readonly required: readonly ["timestamp", "fields"];
|
|
287
|
+
readonly properties: {
|
|
288
|
+
readonly timestamp: {
|
|
289
|
+
readonly type: "number";
|
|
290
|
+
readonly minimum: 0;
|
|
291
|
+
readonly description: "Log timestamp in microseconds since epoch";
|
|
292
|
+
};
|
|
293
|
+
readonly fields: {
|
|
294
|
+
readonly type: "object";
|
|
295
|
+
readonly patternProperties: {
|
|
296
|
+
readonly '^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
297
|
+
readonly oneOf: readonly [{
|
|
298
|
+
readonly type: "string";
|
|
299
|
+
readonly maxLength: 1024;
|
|
300
|
+
}, {
|
|
301
|
+
readonly type: "number";
|
|
302
|
+
}, {
|
|
303
|
+
readonly type: "boolean";
|
|
304
|
+
}];
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
readonly additionalProperties: false;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
readonly maxItems: 100;
|
|
312
|
+
readonly description: "Structured log events within the span";
|
|
313
|
+
};
|
|
314
|
+
readonly status: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
readonly enum: readonly ["OK", "CANCELLED", "UNKNOWN", "INVALID_ARGUMENT", "DEADLINE_EXCEEDED", "NOT_FOUND", "ALREADY_EXISTS", "PERMISSION_DENIED", "RESOURCE_EXHAUSTED", "FAILED_PRECONDITION", "ABORTED", "OUT_OF_RANGE", "UNIMPLEMENTED", "INTERNAL", "UNAVAILABLE", "DATA_LOSS", "UNAUTHENTICATED"];
|
|
317
|
+
readonly description: "Span status indicating success or failure";
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
readonly additionalProperties: false;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
readonly additionalProperties: false;
|
|
324
|
+
};
|
|
325
|
+
//# sourceMappingURL=trace.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/trace.schema.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GlB,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCd,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Trace span event schema for TraceLens
|
|
2
|
+
export const TraceSpanSchema = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
required: ['traceId', 'spanId', 'operationName', 'startTime', 'tags', 'status'],
|
|
5
|
+
properties: {
|
|
6
|
+
traceId: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
pattern: '^[a-f0-9]{32}$',
|
|
9
|
+
description: 'Hexadecimal trace ID (32 characters)'
|
|
10
|
+
},
|
|
11
|
+
spanId: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
pattern: '^[a-f0-9]{16}$',
|
|
14
|
+
description: 'Hexadecimal span ID (16 characters)'
|
|
15
|
+
},
|
|
16
|
+
parentSpanId: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
pattern: '^[a-f0-9]{16}$',
|
|
19
|
+
description: 'Hexadecimal parent span ID (16 characters)'
|
|
20
|
+
},
|
|
21
|
+
operationName: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
minLength: 1,
|
|
24
|
+
maxLength: 256,
|
|
25
|
+
description: 'Name of the operation being traced'
|
|
26
|
+
},
|
|
27
|
+
startTime: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
minimum: 0,
|
|
30
|
+
description: 'Start time in microseconds since epoch'
|
|
31
|
+
},
|
|
32
|
+
endTime: {
|
|
33
|
+
type: 'number',
|
|
34
|
+
minimum: 0,
|
|
35
|
+
description: 'End time in microseconds since epoch'
|
|
36
|
+
},
|
|
37
|
+
duration: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
minimum: 0,
|
|
40
|
+
description: 'Duration in microseconds'
|
|
41
|
+
},
|
|
42
|
+
tags: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
patternProperties: {
|
|
45
|
+
'^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
46
|
+
oneOf: [
|
|
47
|
+
{ type: 'string', maxLength: 1024 },
|
|
48
|
+
{ type: 'number' },
|
|
49
|
+
{ type: 'boolean' }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
description: 'Key-value pairs providing additional context'
|
|
55
|
+
},
|
|
56
|
+
logs: {
|
|
57
|
+
type: 'array',
|
|
58
|
+
items: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
required: ['timestamp', 'fields'],
|
|
61
|
+
properties: {
|
|
62
|
+
timestamp: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
minimum: 0,
|
|
65
|
+
description: 'Log timestamp in microseconds since epoch'
|
|
66
|
+
},
|
|
67
|
+
fields: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
patternProperties: {
|
|
70
|
+
'^[a-zA-Z][a-zA-Z0-9._-]*$': {
|
|
71
|
+
oneOf: [
|
|
72
|
+
{ type: 'string', maxLength: 1024 },
|
|
73
|
+
{ type: 'number' },
|
|
74
|
+
{ type: 'boolean' }
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
additionalProperties: false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
maxItems: 100,
|
|
83
|
+
description: 'Structured log events within the span'
|
|
84
|
+
},
|
|
85
|
+
status: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
enum: [
|
|
88
|
+
'OK',
|
|
89
|
+
'CANCELLED',
|
|
90
|
+
'UNKNOWN',
|
|
91
|
+
'INVALID_ARGUMENT',
|
|
92
|
+
'DEADLINE_EXCEEDED',
|
|
93
|
+
'NOT_FOUND',
|
|
94
|
+
'ALREADY_EXISTS',
|
|
95
|
+
'PERMISSION_DENIED',
|
|
96
|
+
'RESOURCE_EXHAUSTED',
|
|
97
|
+
'FAILED_PRECONDITION',
|
|
98
|
+
'ABORTED',
|
|
99
|
+
'OUT_OF_RANGE',
|
|
100
|
+
'UNIMPLEMENTED',
|
|
101
|
+
'INTERNAL',
|
|
102
|
+
'UNAVAILABLE',
|
|
103
|
+
'DATA_LOSS',
|
|
104
|
+
'UNAUTHENTICATED'
|
|
105
|
+
],
|
|
106
|
+
description: 'Span status indicating success or failure'
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
additionalProperties: false
|
|
110
|
+
};
|
|
111
|
+
export const TraceSchema = {
|
|
112
|
+
type: 'object',
|
|
113
|
+
required: ['traceId', 'spans', 'startTime'],
|
|
114
|
+
properties: {
|
|
115
|
+
traceId: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
pattern: '^[a-f0-9]{32}$',
|
|
118
|
+
description: 'Hexadecimal trace ID (32 characters)'
|
|
119
|
+
},
|
|
120
|
+
spans: {
|
|
121
|
+
type: 'array',
|
|
122
|
+
items: TraceSpanSchema,
|
|
123
|
+
minItems: 1,
|
|
124
|
+
maxItems: 1000,
|
|
125
|
+
description: 'Array of spans that make up this trace'
|
|
126
|
+
},
|
|
127
|
+
startTime: {
|
|
128
|
+
type: 'number',
|
|
129
|
+
minimum: 0,
|
|
130
|
+
description: 'Trace start time in microseconds since epoch'
|
|
131
|
+
},
|
|
132
|
+
endTime: {
|
|
133
|
+
type: 'number',
|
|
134
|
+
minimum: 0,
|
|
135
|
+
description: 'Trace end time in microseconds since epoch'
|
|
136
|
+
},
|
|
137
|
+
duration: {
|
|
138
|
+
type: 'number',
|
|
139
|
+
minimum: 0,
|
|
140
|
+
description: 'Total trace duration in microseconds'
|
|
141
|
+
},
|
|
142
|
+
rootSpan: TraceSpanSchema
|
|
143
|
+
},
|
|
144
|
+
additionalProperties: false
|
|
145
|
+
};
|