@Override
  public LeftronicReporter doCreateInstance(ServiceDefinition def) {
    Properties props = def.getProperties();

    MetricRegistry registry =
        Kernel.getInstance().getApplicationContext().getBean(MetricRegistry.class);

    LeftronicSender leftronic = new LeftronicSender(new AsyncHttpClient());
    leftronic.setApiKey(def.getProperties().getProperty("apiKey"));

    LeftronicReporter.Builder b = LeftronicReporter.forRegistry(registry);

    String prefix = props.getProperty("prefix");
    if (!Strings.isNullOrEmpty(prefix)) {
      b = b.prefixedWith(prefix);
    }

    String includes = props.getProperty("includes", "");
    String excludes = props.getProperty("excludes", ".*counter\\.status.* .*gauge\\.response.*");
    b = b.filter(new RegexMetricFilter().includes(includes).excludes(excludes));

    String rateTimeUnit = props.getProperty("rateTimeUnit", "MINUTES");
    b = b.convertRatesTo(TimeUnit.valueOf(rateTimeUnit));

    String durationTimeUnit = props.getProperty("durationTimeUnit", "MILLISECONDS");
    b = b.convertDurationsTo(TimeUnit.valueOf(durationTimeUnit));

    LeftronicReporter r = b.build(leftronic);

    String reportInterval = props.getProperty("reportInterval", "60");
    String reportIntervalTimeUnit =
        props.getProperty("reportIntervalTimeUnit", TimeUnit.SECONDS.toString());
    r.start(Integer.parseInt(reportInterval), TimeUnit.valueOf(reportIntervalTimeUnit));

    return r;
  }
 @Override
 public void doConfigureDefinition(ServiceDefinition def) {
   def.setLazyInit(false);
 }