@Test public void collectionContext_handling() throws Exception { try (MetricRegistryInstance mr = create(false)) { mr.updateCollection(); } verify(cctx, times(1)).alertManager(); verify(cctx, times(1)).tsdata(); verify(cctx, times(1)).commit(); verifyNoMoreInteractions(cctx); }
public TimeSeriesCollection updateCollection() { final DateTime now = now(); final CollectionContext cctx = beginCollection(now); final MutableTimeSeriesCollectionPair tsdata = cctx.tsdata(); streamGroups(now).forEach(tsdata.getCurrentCollection()::add); final Context ctx = new MutableContext(tsdata, cctx.alertManager()); final long t0 = System.nanoTime(); apply_rules_and_decorators_(ctx); final long t_rule_eval = System.nanoTime(); rule_eval_duration_ = Optional.of(Duration.millis(TimeUnit.NANOSECONDS.toMillis(t_rule_eval - t0))); list_metrics_.update(tsdata.getCurrentCollection()); cctx.commit(); return tsdata.getCurrentCollection(); }
MetricRegistryInstance implements MetricRegistry, AutoCloseable { public TimeSeriesCollection updateCollection() { final DateTime now = now(); final CollectionContext cctx = beginCollection(now); final MutableTimeSeriesCollectionPair tsdata = cctx.tsdata(); streamGroups(now).forEach(tsdata.getCurrentCollection()::add); final Context ctx = new MutableContext(tsdata, cctx.alertManager()); final long t0 = System.nanoTime(); apply_rules_and_decorators_(ctx); final long t_rule_eval = System.nanoTime(); rule_eval_duration_ = Optional.of(Duration.millis(TimeUnit.NANOSECONDS.toMillis(t_rule_eval - t0))); list_metrics_.update(tsdata.getCurrentCollection()); cctx.commit(); return tsdata.getCurrentCollection(); } }
MetricRegistryInstance implements MetricRegistry, AutoCloseable { public TimeSeriesCollection updateCollection() { final DateTime now = now(); final CollectionContext cctx = beginCollection(now); final MutableTimeSeriesCollectionPair tsdata = cctx.tsdata(); streamGroups(now).forEach(tsdata.getCurrentCollection()::add); final Context ctx = new MutableContext(tsdata, cctx.alertManager()); final long t0 = System.nanoTime(); apply_rules_and_decorators_(ctx); final long t_rule_eval = System.nanoTime(); rule_eval_duration_ = Optional.of(Duration.millis(TimeUnit.NANOSECONDS.toMillis(t_rule_eval - t0))); list_metrics_.update(tsdata.getCurrentCollection()); cctx.commit(); return tsdata.getCurrentCollection(); } protected  MetricRegistryInstance(@NonNull Supplier<DateTime> now, boolean has_config, @NonNull EndpointRegistration api); protected  MetricRegistryInstance(boolean has_config, EndpointRegistration api); }
MetricRegistryInstance implements MetricRegistry, AutoCloseable { public TimeSeriesCollection updateCollection() { final DateTime now = now(); final CollectionContext cctx = beginCollection(now); final MutableTimeSeriesCollectionPair tsdata = cctx.tsdata(); streamGroups(now).forEach(tsdata.getCurrentCollection()::add); final Context ctx = new MutableContext(tsdata, cctx.alertManager()); final long t0 = System.nanoTime(); apply_rules_and_decorators_(ctx); final long t_rule_eval = System.nanoTime(); rule_eval_duration_ = Optional.of(Duration.millis(TimeUnit.NANOSECONDS.toMillis(t_rule_eval - t0))); list_metrics_.update(tsdata.getCurrentCollection()); cctx.commit(); return tsdata.getCurrentCollection(); } protected  MetricRegistryInstance(@NonNull Supplier<DateTime> now, boolean has_config, @NonNull EndpointRegistration api); protected  MetricRegistryInstance(boolean has_config, EndpointRegistration api); @Override final void addEndpoint(String pattern, HttpServlet handler); final EndpointRegistration getApi(); synchronized GroupGenerator add(GroupGenerator g); synchronized void remove(GroupGenerator g); long getFailedCollections(); Optional<Duration> getScrapeDuration(); Optional<Duration> getRuleEvalDuration(); Optional<Duration> getProcessorDuration(); void updateProcessorDuration(Duration duration); synchronized void decorate(TimeSeriesTransformer decorator); @Override void close(); @Override boolean hasConfig(); DateTime now(); ExpressionLookBack getDecoratorLookBack(); TimeSeriesCollection updateCollection(); }
MetricRegistryInstance implements MetricRegistry, AutoCloseable { public TimeSeriesCollection updateCollection() { final DateTime now = now(); final CollectionContext cctx = beginCollection(now); final MutableTimeSeriesCollectionPair tsdata = cctx.tsdata(); streamGroups(now).forEach(tsdata.getCurrentCollection()::add); final Context ctx = new MutableContext(tsdata, cctx.alertManager()); final long t0 = System.nanoTime(); apply_rules_and_decorators_(ctx); final long t_rule_eval = System.nanoTime(); rule_eval_duration_ = Optional.of(Duration.millis(TimeUnit.NANOSECONDS.toMillis(t_rule_eval - t0))); list_metrics_.update(tsdata.getCurrentCollection()); cctx.commit(); return tsdata.getCurrentCollection(); } protected  MetricRegistryInstance(@NonNull Supplier<DateTime> now, boolean has_config, @NonNull EndpointRegistration api); protected  MetricRegistryInstance(boolean has_config, EndpointRegistration api); @Override final void addEndpoint(String pattern, HttpServlet handler); final EndpointRegistration getApi(); synchronized GroupGenerator add(GroupGenerator g); synchronized void remove(GroupGenerator g); long getFailedCollections(); Optional<Duration> getScrapeDuration(); Optional<Duration> getRuleEvalDuration(); Optional<Duration> getProcessorDuration(); void updateProcessorDuration(Duration duration); synchronized void decorate(TimeSeriesTransformer decorator); @Override void close(); @Override boolean hasConfig(); DateTime now(); ExpressionLookBack getDecoratorLookBack(); TimeSeriesCollection updateCollection();  }