Skip to content

Commit ea4e611

Browse files
committed
Add window.Glean.debugSession() web API
1 parent 5a2b170 commit ea4e611

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

glean/src/core/glean.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ declare global {
527527
setLogPings: (flag: boolean) => void;
528528
setDebugViewTag: (value: string) => void;
529529
setSourceTags: (value: string[]) => void;
530+
debugSession: () => void;
530531
};
531532
}
532533
}
@@ -558,6 +559,20 @@ if (
558559
"Pings will be given the specified tags until the tab is closed."
559560
);
560561
},
562+
debugSession: () => {
563+
if (!!Context.config.debugViewTag) {
564+
const sessionId = Context.metricsDatabase.getMetric(
565+
CLIENT_INFO_STORAGE,
566+
Context.coreMetrics.sessionId
567+
);
568+
window.open(
569+
`https://debug-ping-preview.firebaseapp.com/stream/${Context.config.debugViewTag}#${sessionId}`,
570+
"_blank"
571+
);
572+
} else {
573+
console.info("You must set a debug tag via `window.Glean.setDebugViewTag` before debugging your session.");
574+
}
575+
}
561576
};
562577
}
563578

0 commit comments

Comments
 (0)