Skip to content

Commit 6852f14

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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

glean/src/core/glean.ts

Lines changed: 16 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,21 @@ if (
558559
"Pings will be given the specified tags until the tab is closed."
559560
);
560561
},
562+
debugSession: () => {
563+
const sessionId = Context.metricsDatabase.getMetric(
564+
CLIENT_INFO_STORAGE,
565+
Context.coreMetrics.sessionId
566+
);
567+
568+
if (!!sessionId && !!Context.config.debugViewTag) {
569+
window.open(
570+
`https://debug-ping-preview.firebaseapp.com/stream/${Context.config.debugViewTag}#${sessionId}`,
571+
"_blank"
572+
);
573+
} else {
574+
console.info("You must set a debug tag via `window.Glean.setDebugViewTag` before debugging your session.");
575+
}
576+
}
561577
};
562578
}
563579

0 commit comments

Comments
 (0)