io.dropwizard.metrics.ReporterFactory Maven / Gradle / Ivy
package io.dropwizard.metrics;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.ScheduledReporter;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.dropwizard.jackson.Discoverable;
import io.dropwizard.util.Duration;
import java.util.Optional;
/**
* A service provider interface for creating metrics {@link ScheduledReporter reporters}.
*
* To create your own, just:
*
* - Create a class which implements {@link ReporterFactory}.
* - Annotate it with {@code @JsonTypeName} and give it a unique type name.
* - Add a {@code META-INF/services/io.dropwizard.metrics.ReporterFactory}
* file with your implementation's full class name to the class path.
*
*
* @see ConsoleReporterFactory
* @see CsvReporterFactory
* @see Slf4jReporterFactory
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public interface ReporterFactory extends Discoverable {
/**
* Returns the frequency for reporting metrics.
*
* @return the frequency for reporting metrics.
*/
Optional getFrequency();
/**
* Configures and builds a {@link ScheduledReporter} instance for the given registry.
*
* @param registry the metrics registry to report metrics from.
*
* @return a reporter configured for the given metrics registry.
*/
ScheduledReporter build(MetricRegistry registry);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy