Java Code Examples for io.micrometer.core.instrument.Gauge#Builder
The following examples show how to use
io.micrometer.core.instrument.Gauge#Builder .
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: MetricsManager.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void registerQueueGauge(String address, String queue, Consumer<MetricGaugeBuilder> builder) { final MeterRegistry meterRegistry = this.meterRegistry; if (meterRegistry == null || !addressSettingsRepository.getMatch(address).isEnableMetrics()) { return; } final List<Gauge.Builder> newMeters = new ArrayList<>(); builder.accept((metricName, state, f, description) -> { Gauge.Builder meter = Gauge .builder("artemis." + metricName, state, f) .tag("broker", brokerName) .tag("address", address) .tag("queue", queue) .description(description); newMeters.add(meter); }); final String resource = ResourceNames.QUEUE + queue; this.meters.compute(resource, (s, meters) -> { //the old meters are ignored on purpose meters = new ArrayList<>(newMeters.size()); for (Gauge.Builder gauge : newMeters) { meters.add(gauge.register(meterRegistry)); } return meters; }); }
Example 2
Source File: MetricsManager.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void registerAddressGauge(String address, Consumer<MetricGaugeBuilder> builder) { final MeterRegistry meterRegistry = this.meterRegistry; if (meterRegistry == null || !addressSettingsRepository.getMatch(address).isEnableMetrics()) { return; } final List<Gauge.Builder> newMeters = new ArrayList<>(); builder.accept((metricName, state, f, description) -> { Gauge.Builder meter = Gauge .builder("artemis." + metricName, state, f) .tag("broker", brokerName) .tag("address", address) .description(description); newMeters.add(meter); }); final String resource = ResourceNames.ADDRESS + address; this.meters.compute(resource, (s, meters) -> { //the old meters are ignored on purpose meters = new ArrayList<>(newMeters.size()); for (Gauge.Builder gauge : newMeters) { meters.add(gauge.register(meterRegistry)); } return meters; }); }
Example 3
Source File: MetricsManager.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void registerBrokerGauge(Consumer<MetricGaugeBuilder> builder) { final MeterRegistry meterRegistry = this.meterRegistry; if (meterRegistry == null) { return; } final List<Gauge.Builder> newMeters = new ArrayList<>(); builder.accept((metricName, state, f, description) -> { Gauge.Builder meter = Gauge .builder("artemis." + metricName, state, f) .tag("broker", brokerName) .description(description); newMeters.add(meter); }); final String resource = ResourceNames.BROKER + "." + brokerName; this.meters.compute(resource, (s, meters) -> { //the old meters are ignored on purpose meters = new ArrayList<>(newMeters.size()); for (Gauge.Builder gauge : newMeters) { meters.add(gauge.register(meterRegistry)); } return meters; }); }
Example 4
Source File: HttpConnectionPoolMetrics.java From riptide with MIT License | 5 votes |
private Gauge.Builder<Supplier<Number>> gauge( final String name, final ToIntFunction<PoolStats> function) { return Gauge.builder(metricName + "." + name, () -> function.applyAsInt(stats.get())) .tags(defaultTags); }
Example 5
Source File: ThreadPoolMetrics.java From riptide with MIT License | 4 votes |
private Gauge.Builder<Supplier<Number>> gauge( final String name, final Supplier<Number> supplier) { return Gauge.builder(metricName + "." + name, supplier) .tags(defaultTags); }