io.micrometer.core.instrument.binder.logging.LogbackMetrics Java Examples

The following examples show how to use io.micrometer.core.instrument.binder.logging.LogbackMetrics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreModule.java    From EDDI with Apache License 2.0 6 votes vote down vote up
@Provides
@Singleton
public PrometheusMeterRegistry providePrometheusMeterRegistry(ExecutorService executorService,
                                                              @Named("systemRuntime.projectName") String projectName) {
    PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
    new LogbackMetrics().bindTo(registry);
    new ClassLoaderMetrics().bindTo(registry);
    new ExecutorServiceMetrics(executorService,
            projectName + "-ExecutorService",
            () -> Tags.of(projectName, "ExecutorService").iterator()).bindTo(registry);
    new JvmMemoryMetrics().bindTo(registry);
    new JvmGcMetrics().bindTo(registry);
    new JvmThreadMetrics().bindTo(registry);
    new ProcessorMetrics().bindTo(registry);
    new ProcessMemoryMetrics().bindTo(registry);
    new ProcessThreadMetrics().bindTo(registry);
    new FileDescriptorMetrics().bindTo(registry);
    new DiskSpaceMetrics(new File("/")).bindTo(registry);
    new UptimeMetrics().bindTo(registry);

    registry.config().commonTags("instance", projectName);
    registry.config().commonTags("application", projectName);
    registry.config().commonTags("service", projectName);

    return registry;
}
 
Example #2
Source File: StatsdMeterRegistryTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Issue("#411")
@Test
void counterIncrementDoesNotCauseStackOverflow() {
    registry = new StatsdMeterRegistry(configWithFlavor(StatsdFlavor.ETSY), clock);
    new LogbackMetrics().bindTo(registry);

    // Cause the processor to get into a state that would make it perform logging at DEBUG level.
    ((Logger) LoggerFactory.getLogger(Operators.class)).setLevel(Level.DEBUG);
    registry.processor.onComplete();

    registry.counter("my.counter").increment();
}
 
Example #3
Source File: MetricsModule.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  bind(MetricsServer.class).asEagerSingleton();
  bind(MetricsBinder.class).asEagerSingleton();
  bind(CollectorRegistry.class).toInstance(CollectorRegistry.defaultRegistry);
  bind(PrometheusMeterRegistry.class)
      .toProvider(PrometheusMeterRegistryProvider.class)
      .asEagerSingleton();
  bind(MeterRegistry.class).to(PrometheusMeterRegistry.class);

  Multibinder<MeterBinder> meterMultibinder =
      Multibinder.newSetBinder(binder(), MeterBinder.class);
  meterMultibinder.addBinding().to(ClassLoaderMetrics.class);
  meterMultibinder.addBinding().to(JvmMemoryMetrics.class);
  meterMultibinder.addBinding().to(JvmGcMetrics.class);
  meterMultibinder.addBinding().to(JvmThreadMetrics.class);
  meterMultibinder.addBinding().to(LogbackMetrics.class);
  meterMultibinder.addBinding().to(FileDescriptorMetrics.class);
  meterMultibinder.addBinding().to(ProcessorMetrics.class);
  meterMultibinder.addBinding().to(UptimeMetrics.class);
  meterMultibinder.addBinding().to(FileStoresMeterBinder.class);
  meterMultibinder.addBinding().to(ApiResponseCounter.class);
  meterMultibinder.addBinding().to(ProcessMemoryMetrics.class);
  meterMultibinder.addBinding().to(ProcessThreadMetrics.class);

  bind(EventListener.class).toProvider(OkHttpMetricsEventListenerProvider.class);
}
 
Example #4
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public void complete() {
    LogbackMetrics.ignoreMetrics(delegate::complete);
}
 
Example #5
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public void error(Throwable e) {
    LogbackMetrics.ignoreMetrics(() -> delegate.error(e));
}
 
Example #6
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public FluxSink<String> next(String s) {
    LogbackMetrics.ignoreMetrics(() -> delegate.next(s));
    return this;
}
 
Example #7
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public FluxSink<String> onRequest(LongConsumer consumer) {
    LogbackMetrics.ignoreMetrics(() -> delegate.onRequest(consumer));
    return this;
}
 
Example #8
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public FluxSink<String> onCancel(Disposable d) {
    LogbackMetrics.ignoreMetrics(() -> delegate.onCancel(d));
    return this;
}
 
Example #9
Source File: LogbackMetricsSuppressingFluxSink.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public FluxSink<String> onDispose(Disposable d) {
    LogbackMetrics.ignoreMetrics(() -> delegate.onDispose(d));
    return this;
}
 
Example #10
Source File: MeterBindersConfiguration.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
LogbackMetrics logbackMetrics() {
  return new LogbackMetrics();
}