File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed
documentation/src/content/docs/debugging Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 22
33[ Full changelog] ( https://github.com/mozilla/glean.js/compare/v5.0.2...main )
44
5+ * [ #1970 ] ( https://github.com/mozilla/glean.js/pull/1970 ) : Add ` window.Glean.debugSession ` API for automatically opening a link to the Debug Ping Viewer with your current session selected.
6+
57# v5.0.2 (2024-05-23)
68
79[ Full changelog] ( https://github.com/mozilla/glean.js/compare/v5.0.1...v5.0.2 )
Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ export async function runWebTest(driver) {
8282 window . Glean &&
8383 window . Glean . setDebugViewTag &&
8484 window . Glean . setLogPings &&
85- window . Glean . setSourceTags
85+ window . Glean . setSourceTags &&
86+ window . Glean . debugSession
8687 ) {
8788 return true ;
8889 }
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ window.Glean.setDebugViewTag("example-tag");
2020
2121// Tag pings with source tags.
2222window .Glean .setSourceTags ([" my-tag" , " your-tag" , " our-tag" ]);
23+
24+ // Open a new tab in the browser showing the Debug Ping Viewer with the active session in focus.
25+ window .Glean .debugSession ();
2326```
2427
2528## Try it out
Original file line number Diff line number Diff 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 && typeof sessionId === "string" && ! ! 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
You can’t perform that action at this time.
0 commit comments