Java Code Examples for io.micrometer.core.instrument.Metrics

The following examples show how to use io.micrometer.core.instrument.Metrics. These examples are extracted from open source projects. 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 Project: summerframework   Source File: MeterMapCleanerTask.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    SimpleMeterRegistry meterRegistry = new SimpleMeterRegistry();
    Metrics.globalRegistry.add(meterRegistry);
    MeterMapCleanerTask task = new MeterMapCleanerTask(Metrics.globalRegistry);
    task.start("0/2 * * * * ?");

    ScheduledExecutorService s = Executors.newSingleThreadScheduledExecutor();
    s.scheduleAtFixedRate(() -> {
        meterRegistry.counter(UUID.randomUUID().toString()).increment();
        System.out.println(meterRegistry.getMeters().size());
    }, 0, 100, TimeUnit.MILLISECONDS);

    try {
        TimeUnit.SECONDS.sleep(5);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    s.shutdown();
    task.stop();
}
 
Example 2
Source Project: summerframework   Source File: OpenfeignMetricsBinder.java    License: Apache License 2.0 6 votes vote down vote up
@Around("execution(* feign.Client.execute(..))")
public Response around(ProceedingJoinPoint pjp) throws Throwable {
    long start = MicrometerUtil.monotonicTime();
    Request request = (Request)pjp.getArgs()[0];
    Response response = null;
    Throwable e = null;
    try {
        response = (Response)pjp.proceed();
    } catch (Throwable t) {
        throw e = t;
    } finally {
        long lapsed = MicrometerUtil.monotonicTime() - start;
        Timer timer = Metrics.timer("openfeign",
            Tags.of(tags)
                .and(Tag.of("status", null == response ? "CLIENT_ERROR" : String.valueOf(response.status())),
                    Tag.of("method", request.method()), Tag.of("class", getKey(CLASS_HEADER, request.headers())),
                    Tag.of("classMethod", getKey(METHOD_HEADER, request.headers()))
                // Tag.of("url", getUrl(request.url()))
                ).and(MicrometerUtil.exceptionAndStatusKey(e)));
        timer.record(lapsed, TimeUnit.NANOSECONDS);
    }
    return response;
}
 
Example 3
Source Project: summerframework   Source File: MetricJdbcEventListener.java    License: Apache License 2.0 6 votes vote down vote up
protected void record(Loggable loggable, long timeElapsedNanos, Category category, SQLException e) {
    try {
        Timer timer =
            Metrics
                .timer(
                    SQL_EXECUTE_TIME, Tags
                        .of(Tag.of("category", category.getName()), Tag.of("readonly", getOrDefault(
                            () -> String.valueOf(loggable.getConnectionInformation().getConnection().isReadOnly()),
                            "error")),
                            Tag.of("autocommit",
                                getOrDefault(
                                    () -> String.valueOf(
                                        loggable.getConnectionInformation().getConnection().getAutoCommit()),
                                    "error")),
                            Tag.of("statement", SqlParser.getSqlType(category, loggable.getSqlWithValues())),
                            Tag.of("jdbc",
                                getHost(
                                    loggable.getConnectionInformation().getConnection().getMetaData().getURL())))
                        .and(MicrometerUtil.exceptionAndStatusKey(e)));
        timer.record(timeElapsedNanos, TimeUnit.NANOSECONDS);
    } catch (Throwable ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
Example 4
Source Project: spring-cloud-task   Source File: TaskMetrics.java    License: Apache License 2.0 6 votes vote down vote up
public void onTaskEnd(TaskExecution taskExecution) {
	if (this.taskSample != null) {
		this.taskSample.stop(Timer.builder(SPRING_CLOUD_TASK_METER)
				.description("Task duration").tags(commonTags(taskExecution))
				.tag(TASK_EXIT_CODE_TAG, "" + taskExecution.getExitCode())
				.tag(TASK_EXCEPTION_TAG,
						(this.exception == null) ? "none"
								: this.exception.getClass().getSimpleName())
				.tag(TASK_STATUS_TAG,
						(this.exception == null) ? STATUS_SUCCESS : STATUS_FAILURE)
				.register(Metrics.globalRegistry));
		this.taskSample = null;
	}

	if (this.longTaskSample != null) {
		this.longTaskSample.stop();
		this.longTaskSample = null;
	}
}
 
Example 5
Source Project: SkaETL   Source File: ProcessStreamService.java    License: Apache License 2.0 6 votes vote down vote up
private void createStreamInput(String inputTopic, String outputTopic) {
    StreamsBuilder builder = new StreamsBuilder();
    KStream<String, String> streamInput = builder.stream(inputTopic, Consumed.with(Serdes.String(), Serdes.String()));

    KStream<String, String> streamParsed = streamInput.mapValues((value) -> {
        Metrics.counter("skaetl_nb_read_kafka_count", Lists.newArrayList(Tag.of("processConsumerName", getProcessConsumer().getName()))).increment();
        return getGenericParser().apply(value, getProcessConsumer());
    }).filter((key, value) -> StringUtils.isNotBlank(value));

    final Serde<String> stringSerdes = Serdes.String();

    streamParsed.to(outputTopic, Produced.with(stringSerdes, stringSerdes));

    KafkaStreams streams = new KafkaStreams(builder.build(), KafkaUtils.createKStreamProperties(getProcessConsumer().getIdProcess() + ProcessConstants.INPUT_PROCESS, getBootstrapServer()));
    Runtime.getRuntime().addShutdownHook(new Thread(streams::close));
    streams.start();
    addStreams(streams);
}
 
Example 6
Source Project: SkaETL   Source File: ConfSkalogsService.java    License: Apache License 2.0 6 votes vote down vote up
public String fetch(String env, String category, String apiKey, String hostname){
    log.error("Call env {} category {} apiKey {} hostname {}",env,category,apiKey,hostname);
    if(checkData(env,category,apiKey,hostname)){
        ConfData confData = ConfData.builder().apiKey(apiKey).category(category).env(env).build();
        Metrics.counter("skaetl_fetch_skalogs_conf",
                Lists.newArrayList(
                        Tag.of("category",category),
                        Tag.of("env", env)
                )
        ).increment();

        updateHost(hostname,env);
        ConfigurationLogstash configFecth = confService.findAll().stream()
                .filter(cl -> cl.getConfData().equals(confData))
                .findFirst().orElse(ConfigurationLogstash.builder().build());
        if(configFecth.statusCustomConfiguration){
            return configFecth.getCustomConfiguration();
        }else{
            return utilsConfig.generateConfig(configFecth);
        }
    }else{
        Metrics.counter("skaetl_fetch_skalogs_conf_error").increment();
        return utilsConfig.generateConfig(ConfigurationLogstash.builder().build());
    }
}
 
Example 7
@Bean
public MetricsReporter prometheusMetricsReporter(PrometheusMeterRegistry prometheusMeterRegistry) {
    Metrics.addRegistry(prometheusMeterRegistry);

    MicrometerMetricsReporter.Builder builder = MicrometerMetricsReporter.newMetricsReporter();
    if (metricsName != null && !metricsName.isEmpty()) {
        builder.withName(metricsName);
    }

    if (metricLabels != null && !metricLabels.isEmpty()) {
        for (MetricLabel label : metricLabels) {
            builder.withCustomLabel(label);
        }
    }
    return builder.build();
}
 
Example 8
@Test
public void testSkipMetricReport() {
    String metricName = "testSkipMetricReport";

    // prepare
    SpanData spanData = defaultMockSpanData();
    MicrometerMetricsReporter reporter = MicrometerMetricsReporter.newMetricsReporter()
            .withName(metricName)
            .withConstLabel("skip", null) // any metric with a null value will cause the reporter to skip
            .build();

    // test
    reporter.reportSpan(spanData);

    // verify
    List<Tag> tags = defaultTags();
    assertEquals(0, Metrics.timer(metricName, tags).count());
}
 
Example 9
@Test
public void testWithTagAndBaggageLabels() {
    String metricName = "testWithTagAndBaggageLabels";

    // prepare
    SpanData spanData = defaultMockSpanData();
    MicrometerMetricsReporter reporter = MicrometerMetricsReporter.newMetricsReporter()
            .withName(metricName)
            .withBaggageLabel(BAGGAGE_LABEL_NAME, BAGGAGE_LABEL_VALUE)
            .withTagLabel(TAG_LABEL_NAME, TAG_LABEL_VALUE)
            .withConstLabel("span.kind", Tags.SPAN_KIND_CLIENT)
            .build();

    // test
    reporter.reportSpan(spanData);

    // verify
    List<Tag> tags = defaultTags();
    tags.add(new ImmutableTag(BAGGAGE_LABEL_NAME, BAGGAGE_LABEL_VALUE));
    tags.add(new ImmutableTag(TAG_LABEL_NAME, TAG_LABEL_VALUE));

    assertEquals(100, (long) registry.find(metricName).timer().totalTime(TimeUnit.MILLISECONDS));
    assertEquals(1, Metrics.timer(metricName, tags).count());
}
 
Example 10
Source Project: edison-microservice   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
private JobRunnable metered(final JobRunnable delegate) {
    return new JobRunnable() {

        @Override
        public JobDefinition getJobDefinition() {
            return delegate.getJobDefinition();
        }

        @Override
        public boolean execute(JobEventPublisher jobEventPublisher) {
            long ts = currentTimeMillis();
            boolean executed = delegate.execute(jobEventPublisher);
            Metrics.gauge(gaugeName(), (currentTimeMillis() - ts) / 1000L);
            return executed;
        }

        private String gaugeName() {
            return "gauge.jobs.runtime." + delegate.getJobDefinition().jobType().toLowerCase();
        }
    };
}
 
Example 11
@Test
public void testWithCustomLabel() {
    String metricName = "testWithCustomLabel";

    // prepare
    SpanData spanData = defaultMockSpanData();
    MetricLabel metricLabel = new BaggageMetricLabel(METRIC_LABEL_NAME, METRIC_LABEL_VALUE);
    MicrometerMetricsReporter reporter = MicrometerMetricsReporter.newMetricsReporter()
            .withName(metricName)
            .withCustomLabel(metricLabel)
            .withConstLabel("span.kind", Tags.SPAN_KIND_CLIENT)
            .build();

    // test
    reporter.reportSpan(spanData);

    // verify
    List<Tag> tags = defaultTags();
    tags.add(new ImmutableTag(METRIC_LABEL_NAME, METRIC_LABEL_VALUE));

    assertEquals(100, (long) registry.find(metricName).timer().totalTime(TimeUnit.MILLISECONDS));
    assertEquals(1, Metrics.timer(metricName, tags).count());
}
 
Example 12
@Test
public void testReportSpan() {
    // prepare
    SpanData spanData = defaultMockSpanData();
    when(spanData.getTags()).thenReturn(Collections.singletonMap(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT));

    MicrometerMetricsReporter reporter = MicrometerMetricsReporter.newMetricsReporter()
            .withConstLabel("span.kind", Tags.SPAN_KIND_CLIENT)
            .build();

    // test
    reporter.reportSpan(spanData);

    // verify
    List<Tag> tags = defaultTags();

    assertEquals(100, (long) registry.find("span").timer().totalTime(TimeUnit.MILLISECONDS));
    assertEquals(1, Metrics.timer("span", tags).count());
}
 
Example 13
Source Project: reactor-core   Source File: SchedulersMetricsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void disablingMetricsRemovesSchedulerMeters() {
	afterTest.autoDispose(Schedulers.newParallel("A", 1));
	afterTest.autoDispose(Schedulers.newParallel("A", 1));
	afterTest.autoDispose(Schedulers.newParallel("A", 1));

	Metrics.globalRegistry.counter("foo", "tagged", "bar");

	Schedulers.disableMetrics();

	assertThat(simpleMeterRegistry.getMeters()
	                              .stream()
	                              .map(m -> m.getId().getName())
	                              .distinct())
			.containsExactly("foo");
}
 
Example 14
Source Project: mewbase   Source File: BinderTests.java    License: MIT License 6 votes vote down vote up
private void metricsExpectations(Long expPuts, Long expGets, Long expDels, Long expDocs, String binderName) {

        final Counter puts = Metrics.globalRegistry.find("mewbase.binder.put")
                .tag("name", binderName)
                .counter();
        assertEquals(expPuts, puts.count(), 0.000001);

        final Counter gets = Metrics.globalRegistry.find("mewbase.binder.get")
                .tag("name", binderName)
                .counter();
        assertEquals(expGets, gets.count(), 0.000001);

        final Counter dels = Metrics.globalRegistry.find("mewbase.binder.delete")
                .tag("name", binderName)
                .counter();
        assertEquals(expDels, dels.count(),0.000001);

        final Gauge docs = Metrics.globalRegistry.find("mewbase.binder.documents")
                .tag("name", binderName)
                .gauge();
        assertEquals(expDocs, docs.value(), 0.000001);
    }
 
Example 15
Source Project: reactor-netty   Source File: UdpMetricsTests.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	udpServer =
			UdpServer.create()
			         .host("127.0.0.1")
			         .port(0)
			         .metrics(true);

	udpClient =
			UdpClient.create()
			         .remoteAddress(() -> serverConnection.address())
			         .metrics(true);

	registry = new SimpleMeterRegistry();
	Metrics.addRegistry(registry);
}
 
Example 16
Source Project: reactor-netty   Source File: TcpMetricsTests.java    License: Apache License 2.0 6 votes vote down vote up
@After
public void tearDown() {
	if (disposableServer != null) {
		disposableServer.disposeNow();
	}

	if (connection != null) {
		connection.disposeNow();
	}

	provider.disposeLater()
	        .block(Duration.ofSeconds(30));

	Metrics.removeRegistry(registry);
	registry.clear();
	registry.close();
}
 
Example 17
Source Project: tutorials   Source File: MicrometerAtlasIntegrationTest.java    License: MIT License 6 votes vote down vote up
@Test
public void givenGlobalRegistry_whenIncrementAnywhere_thenCounted() {
    class CountedObject {
        private CountedObject() {
            Metrics
              .counter("objects.instance")
              .increment(1.0);
        }
    }
    Metrics.addRegistry(new SimpleMeterRegistry());

    Metrics
      .counter("objects.instance")
      .increment();
    new CountedObject();

    Optional<Counter> counterOptional = Metrics.globalRegistry
      .find("objects.instance")
      .counter();

    assertTrue(counterOptional.isPresent());
    assertTrue(counterOptional
      .get()
      .count() == 2.0);
}
 
Example 18
Source Project: spring-cloud-task   Source File: AbstractMicrometerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void before() {
	Metrics.globalRegistry.getMeters().forEach(Metrics.globalRegistry::remove);
	assertThat(simpleMeterRegistry).isNotNull();
	meter = simpleMeterRegistry.find("spring.integration.handlers").meter();
	assertThat(meter).isNotNull().withFailMessage(
			"The spring.integration.handlers meter must be present in SpringBoot apps!");
}
 
Example 19
Source Project: reactor-core   Source File: MonoMetricsFuseableTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void queuePollSyncTracksOnComplete() {
	//prepare registry with mock clock
	MockClock clock = new MockClock();
	removeRegistry();
	registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock);
	Metrics.globalRegistry.add(registry);

	AssertSubscriber<Integer> testSubscriber = AssertSubscriber.create();
	MetricsFuseableSubscriber<Integer> fuseableSubscriber =
			new MetricsFuseableSubscriber<>(testSubscriber,
					registry, clock, Tags.empty());

	Fuseable.QueueSubscription<Integer> testQueue = new FluxPeekFuseableTest.AssertQueueSubscription<>();
	testQueue.offer(1);

	fuseableSubscriber.onSubscribe(testQueue);
	fuseableSubscriber.requestFusion(Fuseable.SYNC);

	clock.add(Duration.ofMillis(200));
	Integer val1 = fuseableSubscriber.poll();
	clock.add(Duration.ofMillis(123));
	Integer val2 = fuseableSubscriber.poll();

	assertThat(val1).isEqualTo(1);
	assertThat(val2).isNull();

	//test meters
	Timer terminationTimer = registry.find(METER_FLOW_DURATION)
	                          .tags(Tags.of(TAG_ON_COMPLETE))
	                          .timer();

	assertThat(terminationTimer).isNotNull();
	assertThat(terminationTimer.max(TimeUnit.MILLISECONDS)).as("terminate max delay").isEqualTo(200);
}
 
Example 20
Source Project: alibaba-rsocket-broker   Source File: ServicesView.java    License: Apache License 2.0 5 votes vote down vote up
public List<ServiceInfo> services(RSocketBrokerHandlerRegistry handlerRegistry, ServiceRoutingSelector routingSelector) {
    return routingSelector.findAllServices()
            .stream()
            .map(serviceLocator -> {
                ServiceInfo serviceInfo = new ServiceInfo(serviceLocator.getGroup(), serviceLocator.getService(), serviceLocator.getVersion(),
                        ((long) (Metrics.counter(serviceLocator.getService() + ".counter").count())),
                        routingSelector.getInstanceCount(serviceLocator.getId()));
                //serviceInfo.setOrgs(String.join(",", serviceRoutingSelector.getServiceOrgs(serviceLocator.getId())));
                //serviceInfo.setServiceAccounts(String.join(",", serviceRoutingSelector.getServiceAccounts(serviceLocator.getId())));
                return serviceInfo;
            }).collect(Collectors.toList());
}
 
Example 21
public static void metrics(GSVRoutingMetadata routingMetadata, String frameType) {
    List<Tag> tags = new ArrayList<>();
    if (routingMetadata.getGroup() != null && !routingMetadata.getGroup().isEmpty()) {
        tags.add(Tag.of("group", routingMetadata.getGroup()));
    }
    if (routingMetadata.getVersion() != null && !routingMetadata.getVersion().isEmpty()) {
        tags.add(Tag.of("version", routingMetadata.getVersion()));
    }
    tags.add(Tag.of("method", routingMetadata.getMethod()));
    tags.add(Tag.of("frame", frameType));
    Metrics.counter(routingMetadata.getService(), tags).increment();
    Metrics.counter("rsocket.request.counter").increment();
    Metrics.counter(routingMetadata.getService() + ".counter").increment();
}
 
Example 22
Source Project: reactor-core   Source File: MonoMetrics.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * For testing purposes.
 *
 * @param meterRegistry the registry to use
 */
MonoMetrics(Mono<? extends T> mono, @Nullable MeterRegistry meterRegistry) {
	super(mono);

	this.name = resolveName(mono);
	this.tags = resolveTags(mono, FluxMetrics.DEFAULT_TAGS_MONO, this.name);

	if (meterRegistry == null) {
		this.meterRegistry = Metrics.globalRegistry;
	}
	else {
		this.meterRegistry = meterRegistry;
	}
}
 
Example 23
Source Project: summerframework   Source File: RabbitMetricsBinder.java    License: Apache License 2.0 5 votes vote down vote up
public RabbitMetricsBinder(AbstractConnectionFactory connectionFactory, Iterable<Tag> tags) {
    this.mBeanServer = getMBeanServer();
    this.tags = tags;
    com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = connectionFactory.getRabbitConnectionFactory();
    String metricsPrefix = "rabbit";

    this.connections = Metrics.gauge((metricsPrefix + ".connections"), new AtomicInteger(0));
    this.channels = Metrics.gauge((metricsPrefix + ".channels"), new AtomicInteger(0));
    this.publishedMessages = Metrics.gauge((metricsPrefix + ".published"), new AtomicInteger(0));
    this.consumedMessages = Metrics.gauge((metricsPrefix + ".consumed"), new AtomicInteger(0));
    this.acknowledgedMessages = Metrics.gauge((metricsPrefix + ".acknowledged"), new AtomicInteger(0));
    this.rejectedMessages = Metrics.gauge((metricsPrefix + ".rejected"), new AtomicInteger(0));

    rabbitConnectionFactory.setMetricsCollector(this);
}
 
Example 24
Source Project: armeria   Source File: ServerBuilderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
void monitorBlockingTaskExecutorAndSchedulersTogetherWithPrometheus() {
    final PrometheusMeterRegistry registry = PrometheusMeterRegistries.newRegistry();
    Metrics.addRegistry(registry);
    Server.builder()
          .meterRegistry(registry)
          .service("/", (ctx, req) -> HttpResponse.of(200))
          .build();
    Schedulers.enableMetrics();
    Schedulers.decorateExecutorService(Schedulers.single(), Executors.newSingleThreadScheduledExecutor());
}
 
Example 25
Source Project: reactor-core   Source File: FluxMetricsFuseableTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void queuePollError() {
	//prepare registry with mock clock
	MockClock clock = new MockClock();
	removeRegistry();
	registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock);
	Metrics.globalRegistry.add(registry);

	AssertSubscriber<Integer> testSubscriber = AssertSubscriber.create();
	FluxMetricsFuseable.MetricsFuseableSubscriber<Integer> fuseableSubscriber =
			new FluxMetricsFuseable.MetricsFuseableSubscriber<>(testSubscriber,
					registry, clock, "foo", Tags.empty());

	FluxPeekFuseableTest.AssertQueueSubscription<Integer> testQueue = new FluxPeekFuseableTest.AssertQueueSubscription<>();
	testQueue.setCompleteWithError(true);
	testQueue.offer(1);

	fuseableSubscriber.onSubscribe(testQueue);
	fuseableSubscriber.requestFusion(Fuseable.SYNC);

	clock.add(Duration.ofMillis(200));
	Integer val1 = fuseableSubscriber.poll();
	assertThat(val1).isEqualTo(1);

	clock.add(Duration.ofMillis(123));
	assertThatIllegalStateException().isThrownBy(fuseableSubscriber::poll)
	                                 .withMessage("AssertQueueSubscriber poll error");

	//test meters
	Timer terminationTimer = registry.find(METER_FLOW_DURATION)
	                          .tags(Tags.of(TAG_ON_ERROR))
	                          .timer();

	assertThat(terminationTimer).isNotNull();
	assertThat(terminationTimer.max(TimeUnit.MILLISECONDS)).as("terminate max delay").isEqualTo(323);
}
 
Example 26
Source Project: reactor-core   Source File: FluxMetrics.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * For testing purposes.
 *
 * @param registry the registry to use, or null for global one
 */
FluxMetrics(Flux<? extends T> flux, @Nullable MeterRegistry registry) {
	super(flux);

	this.name = resolveName(flux);
	this.tags = resolveTags(flux, DEFAULT_TAGS_FLUX, this.name);

	if (registry == null) {
		this.registryCandidate = Metrics.globalRegistry;
	}
	else {
		this.registryCandidate = registry;
	}
}
 
Example 27
Source Project: summerframework   Source File: Monitors.java    License: Apache License 2.0 5 votes vote down vote up
public static final void count(String name, String... tags) {
    try {
        Metrics.counter(name, MicrometerUtil.tags(tags)).increment();
    } catch (Throwable e) {
        LOGGER.warn(" count error", e);
    }
}
 
Example 28
Source Project: summerframework   Source File: Monitors.java    License: Apache License 2.0 5 votes vote down vote up
public static final <T extends Number> void gauge(String name, T number, String... tags) {
    try {
        Metrics.gauge(name, MicrometerUtil.tags(tags), number);
    } catch (Throwable e) {
        LOGGER.warn(" gauge error", e);
    }
}
 
Example 29
Source Project: cloudbreak   Source File: AbstractMetricService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void submit(Metric metric, double value, Map<String, String> labels) {
    String metricName = getMetricName(metric);

    Iterable<Tag> tags = labels.entrySet().stream().map(label -> Tag.of(label.getKey(), label.getValue().toLowerCase())).collect(Collectors.toList());
    Metrics.gauge(metricName, tags, value);
}
 
Example 30
Source Project: summerframework   Source File: Monitors.java    License: Apache License 2.0 5 votes vote down vote up
public static final <T extends Map<?, ?>> T gaugeMapSize(String name, T map, String... tags) {
    try {
        return Metrics.gaugeMapSize(name, MicrometerUtil.tags(tags), map);
    } catch (Throwable e) {
        LOGGER.warn(" gaugeMapSize error", e);
    }
    return null;
}