All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jd.blockchain.metrics.LedgerMetrics Maven / Gradle / Ivy

There is a newer version: 1.6.5.RELEASE
Show newest version
package com.jd.blockchain.metrics;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;

import java.util.concurrent.atomic.AtomicLong;

public class LedgerMetrics {

    public static final String LEDGER_HASH = "ledger";
    public static final String BLOCK_HEIGHT_METER = "block_height";

    private AtomicLong blockHeight;

    public LedgerMetrics(String ledger, MeterRegistry registry) {
        blockHeight = registry.gauge(BLOCK_HEIGHT_METER, Tags.of(LEDGER_HASH, ledger), new AtomicLong(0), h -> h.get());
    }

    public void block(long height) {
        blockHeight.set(height);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy