fix: compact hwlab web probe trace samples
This commit is contained in:
@@ -9285,7 +9285,7 @@ function compactWebProbeResult(report: Record<string, unknown> | null): Record<s
|
||||
session,
|
||||
trace,
|
||||
performance,
|
||||
traceSamples: Array.isArray(report.traceSamples) ? report.traceSamples : [],
|
||||
traceSamples: compactWebProbeTraceSamples(report.traceSamples),
|
||||
dom: {
|
||||
authState: typeof dom.authState === "string" ? dom.authState : null,
|
||||
requiredSelectors: record(dom.requiredSelectors),
|
||||
@@ -9298,6 +9298,36 @@ function compactWebProbeResult(report: Record<string, unknown> | null): Record<s
|
||||
};
|
||||
}
|
||||
|
||||
function compactWebProbeTraceSamples(value: unknown): Record<string, unknown>[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.map(record).map((sample) => {
|
||||
const traceFetch = record(sample.traceFetch);
|
||||
const attempts = Array.isArray(traceFetch.attempts) ? traceFetch.attempts : [];
|
||||
return {
|
||||
index: sample.index ?? null,
|
||||
sampledAt: sample.sampledAt ?? null,
|
||||
messageCount: sample.messageCount ?? null,
|
||||
agentStatus: sample.agentStatus ?? null,
|
||||
tracePresent: sample.tracePresent === true,
|
||||
traceStatus: sample.traceStatus ?? null,
|
||||
rowCount: sample.rowCount ?? null,
|
||||
emptyLabel: sample.emptyLabel ?? null,
|
||||
latestRowPreview: sample.latestRowPreview ?? null,
|
||||
conversationId: sample.conversationId ?? null,
|
||||
sessionId: sample.sessionId ?? null,
|
||||
traceId: sample.traceId ?? null,
|
||||
traceFetch: {
|
||||
ok: traceFetch.ok === true,
|
||||
httpStatus: traceFetch.httpStatus ?? null,
|
||||
eventCount: traceFetch.eventCount ?? null,
|
||||
degradedReason: traceFetch.degradedReason ?? null,
|
||||
attempts: attempts.length,
|
||||
latestEventPreview: traceFetch.latestEventPreview ?? null,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function compactWebProbeActions(value: unknown): Record<string, unknown>[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.map(record).map((action) => {
|
||||
|
||||
Reference in New Issue
Block a user