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

pl.allegro.tech.hermes.common.metric.SchemaClientMetrics Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package pl.allegro.tech.hermes.common.metric;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.Timer;
import pl.allegro.tech.hermes.metrics.HermesTimer;

public class SchemaClientMetrics {
    private final MeterRegistry meterRegistry;

    public SchemaClientMetrics(MeterRegistry meterRegistry) {
        this.meterRegistry = meterRegistry;
    }

    public HermesTimer schemaTimer() {
        return HermesTimer.from(
                timer("schema.get-schema")
        );
    }

    public HermesTimer versionsTimer() {
        return HermesTimer.from(
                timer("schema.get-versions")
        );
    }

    private Timer timer(String name) {
        return meterRegistry.timer(name, Tags.of("schema_repo_type", "schema-registry"));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy