@interfere/test-utils 10.1.0-rc.1 → 10.1.0-rc.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.
- package/CHANGELOG.md +6 -0
- package/dist/vitest/otlp.d.mts +8 -0
- package/dist/vitest/otlp.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/vitest/otlp.d.mts
CHANGED
|
@@ -33,6 +33,10 @@ export declare function exportedSpans(requests: ReceivedRequest[]): {
|
|
|
33
33
|
};
|
|
34
34
|
}[];
|
|
35
35
|
}[];
|
|
36
|
+
links: {
|
|
37
|
+
traceId: string;
|
|
38
|
+
spanId: string;
|
|
39
|
+
}[];
|
|
36
40
|
status?: {
|
|
37
41
|
code?: number | undefined;
|
|
38
42
|
} | undefined;
|
|
@@ -70,6 +74,10 @@ export declare function exceptions(requests: ReceivedRequest[], message: string)
|
|
|
70
74
|
};
|
|
71
75
|
}[];
|
|
72
76
|
}[];
|
|
77
|
+
links: {
|
|
78
|
+
traceId: string;
|
|
79
|
+
spanId: string;
|
|
80
|
+
}[];
|
|
73
81
|
status?: {
|
|
74
82
|
code?: number | undefined;
|
|
75
83
|
} | undefined;
|
package/dist/vitest/otlp.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"zod";const attributes=z.array(z.object({key:z.string(),value:z.object({stringValue:z.string().optional(),boolValue:z.boolean().optional(),intValue:z.union([z.string(),z.number()]).optional()})})),span=z.object({name:z.string(),traceId:z.string(),spanId:z.string(),parentSpanId:z.string().optional(),attributes:attributes.default([]),events:z.array(z.object({name:z.string(),attributes:attributes.default([])})).default([]),status:z.object({code:z.number().optional()}).optional()}),traces=z.object({resourceSpans:z.array(z.object({resource:z.object({attributes}),scopeSpans:z.array(z.object({spans:z.array(span)}))}))});function exportedSpans(requests){return requests.filter(request=>request.url.startsWith(`/drain/v1/traces`)&&request.status<300).flatMap(request=>traces.parse(JSON.parse(request.body)).resourceSpans.flatMap(resource=>resource.scopeSpans.flatMap(scope=>scope.spans.map(item=>({...item,resource:resource.resource.attributes})))))}function attribute(values,key){let value=values.find(item=>item.key===key)?.value;return value?.stringValue??value?.boolValue??value?.intValue}function exceptions(requests,message){return exportedSpans(requests).filter(item=>item.events.some(event=>event.name===`exception`&&attribute(event.attributes,`exception.message`)===message))}const logs=z.object({resourceLogs:z.array(z.object({resource:z.object({attributes}),scopeLogs:z.array(z.object({logRecords:z.array(z.object({eventName:z.string().optional(),attributes:attributes.default([]),traceId:z.string().optional(),spanId:z.string().optional()}))}))}))});function exportedLogRecords(requests){return requests.filter(request=>request.url.startsWith(`/drain/v1/logs`)&&request.status<300).flatMap(request=>logs.parse(JSON.parse(request.body)).resourceLogs.flatMap(resource=>resource.scopeLogs.flatMap(scope=>scope.logRecords.map(item=>({...item,resource:resource.resource.attributes})))))}export{attribute,exceptions,exportedLogRecords,exportedSpans};
|
|
1
|
+
import{z}from"zod";const attributes=z.array(z.object({key:z.string(),value:z.object({stringValue:z.string().optional(),boolValue:z.boolean().optional(),intValue:z.union([z.string(),z.number()]).optional()})})),span=z.object({name:z.string(),traceId:z.string(),spanId:z.string(),parentSpanId:z.string().optional(),attributes:attributes.default([]),events:z.array(z.object({name:z.string(),attributes:attributes.default([])})).default([]),links:z.array(z.object({traceId:z.string(),spanId:z.string()})).default([]),status:z.object({code:z.number().optional()}).optional()}),traces=z.object({resourceSpans:z.array(z.object({resource:z.object({attributes}),scopeSpans:z.array(z.object({spans:z.array(span)}))}))});function exportedSpans(requests){return requests.filter(request=>request.url.startsWith(`/drain/v1/traces`)&&request.status<300).flatMap(request=>traces.parse(JSON.parse(request.body)).resourceSpans.flatMap(resource=>resource.scopeSpans.flatMap(scope=>scope.spans.map(item=>({...item,resource:resource.resource.attributes})))))}function attribute(values,key){let value=values.find(item=>item.key===key)?.value;return value?.stringValue??value?.boolValue??value?.intValue}function exceptions(requests,message){return exportedSpans(requests).filter(item=>item.events.some(event=>event.name===`exception`&&attribute(event.attributes,`exception.message`)===message))}const logs=z.object({resourceLogs:z.array(z.object({resource:z.object({attributes}),scopeLogs:z.array(z.object({logRecords:z.array(z.object({eventName:z.string().optional(),attributes:attributes.default([]),traceId:z.string().optional(),spanId:z.string().optional()}))}))}))});function exportedLogRecords(requests){return requests.filter(request=>request.url.startsWith(`/drain/v1/logs`)&&request.status<300).flatMap(request=>logs.parse(JSON.parse(request.body)).resourceLogs.flatMap(resource=>resource.scopeLogs.flatMap(scope=>scope.logRecords.map(item=>({...item,resource:resource.resource.attributes})))))}export{attribute,exceptions,exportedLogRecords,exportedSpans};
|
package/package.json
CHANGED