fix(workbench): avoid duplicate rum api samples (#1938)
This commit is contained in:
@@ -37,6 +37,7 @@ export function installWebRum(): void {
|
|||||||
|
|
||||||
export function recordApiTiming(input: ApiTimingInput): void {
|
export function recordApiTiming(input: ApiTimingInput): void {
|
||||||
if (typeof window === "undefined") return;
|
if (typeof window === "undefined") return;
|
||||||
|
if (isWorkbenchPageRoute()) return;
|
||||||
const valueMs = Math.max(0, Date.now() - input.startedAt);
|
const valueMs = Math.max(0, Date.now() - input.startedAt);
|
||||||
enqueue({
|
enqueue({
|
||||||
kind: "api",
|
kind: "api",
|
||||||
@@ -118,6 +119,11 @@ function pageRoute(): string {
|
|||||||
return `${window.location.pathname}${window.location.hash || ""}` || "/";
|
return `${window.location.pathname}${window.location.hash || ""}` || "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isWorkbenchPageRoute(): boolean {
|
||||||
|
const pathname = window.location.pathname || "";
|
||||||
|
return pathname.startsWith("/workbench") || pathname.startsWith("/workspace");
|
||||||
|
}
|
||||||
|
|
||||||
function statusClass(status?: number): string {
|
function statusClass(status?: number): string {
|
||||||
if (!status || !Number.isFinite(status)) return "network";
|
if (!status || !Number.isFinite(status)) return "network";
|
||||||
return `${Math.floor(status / 100)}xx`;
|
return `${Math.floor(status / 100)}xx`;
|
||||||
|
|||||||
Reference in New Issue
Block a user