@@ -271,6 +271,9 @@ export class MetricsReporter {
271271 } ,
272272 ) {
273273 this . metricsHost = `ide.${ new URL ( options . gitpodUrl ) . hostname } ` ;
274+ if ( typeof window !== "undefined" ) {
275+ this . options . commonErrorDetails [ "userAgent" ] = window . navigator . userAgent
276+ }
274277 }
275278
276279 updateCommonErrorDetails ( update : { [ key : string ] : string | undefined } ) {
@@ -305,6 +308,9 @@ export class MetricsReporter {
305308 if ( ! enabled ) {
306309 return ;
307310 }
311+ if ( typeof window !== undefined && ! window . navigator . onLine ) {
312+ return ;
313+ }
308314
309315 const metrics = await register . getMetricsAsJSON ( ) ;
310316 register . resetMetrics ( ) ;
@@ -404,9 +410,14 @@ export class MetricsReporter {
404410 return ;
405411 }
406412 const properties = { ...data , ...this . options . commonErrorDetails } ;
413+ properties [ "error_timestamp" ] = new Date ( ) . toISOString ( ) ;
407414 properties [ "error_name" ] = error . name ;
408415 properties [ "error_message" ] = error . message ;
409416
417+ if ( typeof window !== undefined ) {
418+ properties [ "onLine" ] = String ( window . navigator . onLine ) ;
419+ }
420+ 410421 const workspaceId = properties [ "workspaceId" ] ;
411422 const instanceId = properties [ "instanceId" ] ;
412423 const userId = properties [ "userId" ] ;
@@ -456,7 +467,11 @@ export class MetricsReporter {
456467
457468 private async send ( request : MetricsRequest | undefined ) : Promise < void > {
458469 if ( ! request ) {
459- return request ;
470+ return ;
471+ }
472+ if ( typeof window !== undefined && ! window . navigator . onLine ) {
473+ this . push ( request ) ;
474+ return ;
460475 }
461476 this . sendQueue = this . sendQueue . then ( async ( ) => {
462477 try {
0 commit comments