@@ -578,45 +578,46 @@ public bool EnableBreadcrumbsSupport()
578578 return Database . EnableBreadcrumbsSupport ( ) ;
579579 }
580580#if ! UNITY_WEBGL
581- public void EnableMetrics ( )
581+ public bool EnableMetrics ( )
582582 {
583- EnableMetrics ( true ) ;
583+ return EnableMetrics ( true ) ;
584584 }
585- private void EnableMetrics ( bool enableIfConfigurationIsDisabled = true )
585+ private bool EnableMetrics ( bool enableIfConfigurationIsDisabled = true )
586586 {
587587 if ( ! Configuration . EnableMetricsSupport )
588588 {
589589 if ( ! enableIfConfigurationIsDisabled )
590590 {
591- return ;
591+ return false ;
592592 }
593593 Debug . LogWarning ( "Event aggregation configuration was disabled. Enabling it manually via API" ) ;
594594 }
595- var universeName = Configuration . GetUniverseName ( ) ;
596- var token = Configuration . GetToken ( ) ;
597- EnableMetrics (
598- BacktraceMetrics . GetDefaultUniqueEventsUrl ( universeName , token ) ,
599- BacktraceMetrics . GetDefaultSummedEventsUrl ( universeName , token ) ,
600- Configuration . GetEventAggregationIntervalTimerInMs ( ) ) ;
595+ return EnableMetrics ( BacktraceMetrics . DefaultUniqueAttributeName ) ;
601596 }
602597
603- public void EnableMetrics ( string uniqueAttributeName = BacktraceMetrics . DefaultUniqueAttributeName )
598+ public bool EnableMetrics ( string uniqueAttributeName = BacktraceMetrics . DefaultUniqueAttributeName )
604599 {
605600 var universeName = Configuration . GetUniverseName ( ) ;
601+ if ( string . IsNullOrEmpty ( universeName ) )
602+ {
603+ Debug . LogWarning ( "Cannot initialize event aggregation - Unknown Backtrace URL." ) ;
604+ return false ;
605+ }
606606 var token = Configuration . GetToken ( ) ;
607607 EnableMetrics (
608608 BacktraceMetrics . GetDefaultUniqueEventsUrl ( universeName , token ) ,
609609 BacktraceMetrics . GetDefaultSummedEventsUrl ( universeName , token ) ,
610610 Configuration . GetEventAggregationIntervalTimerInMs ( ) ,
611611 uniqueAttributeName ) ;
612+ return true ;
612613 }
613614
614- public void EnableMetrics ( string uniqueEventsSubmissionUrl , string summedEventsSubmissionUrl , uint timeIntervalInSec = BacktraceMetrics . DefaultTimeIntervalInSec , string uniqueAttributeName = BacktraceMetrics . DefaultUniqueAttributeName )
615+ public bool EnableMetrics ( string uniqueEventsSubmissionUrl , string summedEventsSubmissionUrl , uint timeIntervalInSec = BacktraceMetrics . DefaultTimeIntervalInSec , string uniqueAttributeName = BacktraceMetrics . DefaultUniqueAttributeName )
615616 {
616617 if ( _metrics != null )
617618 {
618619 Debug . LogWarning ( "Backtrace metrics support is enabled. Please use BacktraceClient.Metrics." ) ;
619- return ;
620+ return false ;
620621 }
621622 _metrics = new BacktraceMetrics (
622623 attributeProvider : AttributeProvider ,
@@ -629,6 +630,7 @@ public void EnableMetrics(string uniqueEventsSubmissionUrl, string summedEventsS
629630 IgnoreSslValidation = Configuration . IgnoreSslValidation
630631 } ;
631632 StartupMetrics ( ) ;
633+ return true ;
632634 }
633635
634636 private void StartupMetrics ( )
0 commit comments