Esempio n. 1
0
 /**
  * Create a BugSnag Client, we rely on the configuration URL to create this object
  *
  * @return BugSnag Client
  */
 @Bean
 @Scope(value = "singleton")
 public Client getBugSnagClient() {
   if (configuration.getApp().getMode().equals(MovieTimeConfig.RunModeEnum.TEST)) return null;
   Client bugSnag = new Client(configuration.getApp().getBugSnag());
   // set the current version
   bugSnag.setAppVersion(configuration.getApp().getVersion());
   // set the current release stage
   bugSnag.setReleaseStage(configuration.getApp().getMode().toString());
   // notify about exception only in production mode;
   bugSnag.setNotifyReleaseStages(MovieTimeConfig.RunModeEnum.PROD.toString());
   log.info(
       "BugSnag bootstrapped with application version {}", configuration.getApp().getVersion());
   return bugSnag;
 }
Esempio n. 2
0
 private MetricRegistry buildMetricRegistry() {
   metricRegistry = new MetricRegistry();
   // set graphite reporter
   final MovieTimeConfig.GraphiteConfig graphiteConfig = configuration.getGraphite();
   if (graphiteConfig.isActivate()) {
     final Graphite graphite =
         new Graphite(new InetSocketAddress(graphiteConfig.getHost(), graphiteConfig.getPort()));
     final GraphiteReporter graphiteReporter =
         GraphiteReporter.forRegistry(metricRegistry)
             .prefixedWith(graphiteConfig.getApiKey())
             .convertRatesTo(TimeUnit.SECONDS)
             .convertDurationsTo(TimeUnit.MILLISECONDS)
             .filter(MetricFilter.ALL)
             .build(graphite);
     graphiteReporter.start(1, TimeUnit.MINUTES);
     log.info("Metrics graphite reporter bootstrapped");
   } else {
     log.info("Metrics reporter not running");
   }
   return metricRegistry;
 }