mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 10:33:36 +00:00
test(qa): annotate live transport RTT measurements
This commit is contained in:
@@ -181,7 +181,15 @@ type DiscordQaScenarioResult = {
|
||||
title: string;
|
||||
status: "pass" | "fail";
|
||||
details: string;
|
||||
requestStartedAt?: string;
|
||||
responseObservedAt?: string;
|
||||
rttMs?: number;
|
||||
rttMeasurement?: {
|
||||
finalMatchedReplyRttMs: number;
|
||||
requestStartedAt: string;
|
||||
responseObservedAt: string;
|
||||
source: "request-to-observed-message";
|
||||
};
|
||||
};
|
||||
|
||||
type DiscordQaRunResult = {
|
||||
@@ -1779,7 +1787,9 @@ export async function runDiscordQaLive(params: {
|
||||
expectedTextIncludes: scenarioRun.expectedTextIncludes,
|
||||
message: matched.message,
|
||||
});
|
||||
const rttMs = computeDiscordRttMs(sent.timestamp, matched.message.timestamp);
|
||||
const requestStartedAt = sent.timestamp;
|
||||
const responseObservedAt = matched.message.timestamp;
|
||||
const rttMs = computeDiscordRttMs(requestStartedAt, responseObservedAt);
|
||||
scenarioResults.push({
|
||||
id: scenario.id,
|
||||
title: scenario.title,
|
||||
@@ -1787,7 +1797,21 @@ export async function runDiscordQaLive(params: {
|
||||
details: redactPublicMetadata
|
||||
? "reply matched"
|
||||
: `reply message ${matched.message.messageId} matched`,
|
||||
...(rttMs === undefined ? {} : { rttMs }),
|
||||
...(requestStartedAt === undefined ? {} : { requestStartedAt }),
|
||||
...(responseObservedAt === undefined ? {} : { responseObservedAt }),
|
||||
...(rttMs === undefined ||
|
||||
requestStartedAt === undefined ||
|
||||
responseObservedAt === undefined
|
||||
? {}
|
||||
: {
|
||||
rttMs,
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: rttMs,
|
||||
requestStartedAt,
|
||||
responseObservedAt,
|
||||
source: "request-to-observed-message",
|
||||
},
|
||||
}),
|
||||
});
|
||||
} catch (error) {
|
||||
if (scenarioRun.kind === "channel-message" && !scenarioRun.expectReply) {
|
||||
|
||||
@@ -200,6 +200,12 @@ type SlackQaScenarioResult = {
|
||||
requestStartedAt?: string;
|
||||
responseObservedAt?: string;
|
||||
rttMs?: number;
|
||||
rttMeasurement?: {
|
||||
finalMatchedReplyRttMs: number;
|
||||
requestStartedAt: string;
|
||||
responseObservedAt: string;
|
||||
source: "approval-request-to-resolution" | "request-to-observed-message";
|
||||
};
|
||||
status: "fail" | "pass";
|
||||
title: string;
|
||||
};
|
||||
@@ -1859,6 +1865,12 @@ export async function runSlackQaLive(params: {
|
||||
rttMs: approval.rttMs,
|
||||
requestStartedAt: approval.requestStartedAt.toISOString(),
|
||||
responseObservedAt: approval.responseObservedAt.toISOString(),
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: approval.rttMs,
|
||||
requestStartedAt: approval.requestStartedAt.toISOString(),
|
||||
responseObservedAt: approval.responseObservedAt.toISOString(),
|
||||
source: "approval-request-to-resolution",
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -1911,6 +1923,12 @@ export async function runSlackQaLive(params: {
|
||||
rttMs,
|
||||
requestStartedAt: requestStartedAt.toISOString(),
|
||||
responseObservedAt: responseObservedAt.toISOString(),
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: rttMs,
|
||||
requestStartedAt: requestStartedAt.toISOString(),
|
||||
responseObservedAt: responseObservedAt.toISOString(),
|
||||
source: "request-to-observed-message",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await waitForSlackNoReply({
|
||||
|
||||
@@ -133,6 +133,12 @@ type TelegramQaScenarioResult = {
|
||||
rttMs?: number;
|
||||
requestStartedAt?: string;
|
||||
responseObservedAt?: string;
|
||||
rttMeasurement?: {
|
||||
finalMatchedReplyRttMs: number;
|
||||
requestStartedAt: string;
|
||||
responseObservedAt: string;
|
||||
source: "request-to-observed-message";
|
||||
};
|
||||
sentMessageId?: number;
|
||||
responseMessageId?: number;
|
||||
};
|
||||
@@ -1743,6 +1749,12 @@ export async function runTelegramQaLive(params: {
|
||||
rttMs: canaryTiming.rttMs,
|
||||
requestStartedAt: canaryTiming.requestStartedAt,
|
||||
responseObservedAt: canaryTiming.responseObservedAt,
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: canaryTiming.rttMs,
|
||||
requestStartedAt: canaryTiming.requestStartedAt,
|
||||
responseObservedAt: canaryTiming.responseObservedAt,
|
||||
source: "request-to-observed-message",
|
||||
},
|
||||
sentMessageId: redactPublicMetadata ? undefined : canaryTiming.sentMessageId,
|
||||
responseMessageId: redactPublicMetadata ? undefined : canaryTiming.responseMessageId,
|
||||
});
|
||||
@@ -1885,6 +1897,12 @@ export async function runTelegramQaLive(params: {
|
||||
rttMs,
|
||||
requestStartedAt: firstRequestStartedAt,
|
||||
responseObservedAt: new Date(lastMatched.observedAtMs).toISOString(),
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: rttMs,
|
||||
requestStartedAt: new Date(lastRequestStartedAtMs).toISOString(),
|
||||
responseObservedAt: new Date(lastMatched.observedAtMs).toISOString(),
|
||||
source: "request-to-observed-message",
|
||||
},
|
||||
sentMessageId: redactPublicMetadata ? undefined : lastSentMessageId,
|
||||
responseMessageId: redactPublicMetadata ? undefined : lastMatched.message.messageId,
|
||||
} satisfies TelegramQaScenarioResult;
|
||||
|
||||
@@ -100,6 +100,12 @@ type WhatsAppQaScenarioResult = {
|
||||
requestStartedAt?: string;
|
||||
responseObservedAt?: string;
|
||||
rttMs?: number;
|
||||
rttMeasurement?: {
|
||||
finalMatchedReplyRttMs: number;
|
||||
requestStartedAt: string;
|
||||
responseObservedAt: string;
|
||||
source: "request-to-observed-message";
|
||||
};
|
||||
status: "fail" | "pass" | "skip";
|
||||
title: string;
|
||||
};
|
||||
@@ -647,6 +653,12 @@ async function runWhatsAppScenario(params: {
|
||||
rttMs,
|
||||
requestStartedAt: requestStartedAt.toISOString(),
|
||||
responseObservedAt: responseObservedAt.toISOString(),
|
||||
rttMeasurement: {
|
||||
finalMatchedReplyRttMs: rttMs,
|
||||
requestStartedAt: requestStartedAt.toISOString(),
|
||||
responseObservedAt: responseObservedAt.toISOString(),
|
||||
source: "request-to-observed-message",
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
preservedGatewayDebug = true;
|
||||
|
||||
Reference in New Issue
Block a user