Package io.perl.logger.impl
Class PrintMetrics
java.lang.Object
io.perl.logger.impl.Metrics
io.perl.logger.impl.PrintMetrics
- All Implemented Interfaces:
Print
- Direct Known Subclasses:
PrometheusMetricsServer
Metric-backed results reporter that publishes values to a Micrometer
CompositeMeterRegistry.
This class registers counters and gauges for common result fields
(bytes, records, rates and latencies) and provides a print(double, long, long, double, double, double, long, long, long, long, long, long, long, long[], long[])
implementation that updates the registered instruments. It is primarily
used as the backing implementation for Prometheus exposition.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal io.micrometer.core.instrument.MeterRegistryMeterRegistry registry.Fields inherited from class io.perl.logger.impl.Metrics
avgLatencyName, bytesName, higherDiscardName, invalidLatencyRecordsName, lowerDiscardName, maxLatencyName, mbPsecName, metricPrefix, metricTimeUnit, minLatencyName, percentileFormat, percentileLatencyCountNames, percentileLatencyNames, recordsName, recsPsecName, slc1Name, slc2Name -
Constructor Summary
ConstructorsConstructorDescriptionPrintMetrics(@NotNull String header, @org.jetbrains.annotations.NotNull double[] percentiles, Time time, @NotNull TimeUnit latencyTimeUnit, io.micrometer.core.instrument.composite.CompositeMeterRegistry compositeRegistry) Constructor PrintMetrics initializing all values. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method Closes this registry, releasing any resources in the process.final voidprint(double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts) Print the periodic performance results.
-
Field Details
-
registry
public final io.micrometer.core.instrument.MeterRegistry registryMeterRegistry registry.
-
-
Constructor Details
-
PrintMetrics
public PrintMetrics(@NotNull @NotNull String header, @NotNull @org.jetbrains.annotations.NotNull double[] percentiles, Time time, @NotNull @NotNull TimeUnit latencyTimeUnit, io.micrometer.core.instrument.composite.CompositeMeterRegistry compositeRegistry) Constructor PrintMetrics initializing all values.- Parameters:
header- NotNull Stringpercentiles- NotNull double[]time- TimelatencyTimeUnit- NotNull TimeUnitcompositeRegistry- CompositeMeterRegistry
-
-
Method Details
-
close
public void close()This method Closes this registry, releasing any resources in the process. Once closed, this registry will no longer accept new meters and any publishing activity will cease. -
print
public final void print(double seconds, long bytes, long records, double recsPerSec, double mbPerSec, double avgLatency, long minLatency, long maxLatency, long invalid, long lowerDiscard, long higherDiscard, long slc1, long slc2, long[] percentileLatencies, long[] percentileLatencyCounts) Description copied from interface:PrintPrint the periodic performance results.Implementations should interpret the latency values according to the
PerformanceLogger.getTimeUnit()provided by the configured logger. The arrayspercentileLatenciesandpercentileLatencyCounts(if non-null) are parallel: the element at indexiinpercentileLatencyCountscorresponds to the latency value at indexiinpercentileLatencies.- Specified by:
printin interfacePrint- Parameters:
seconds- Reporting duration in secondsbytes- Number of bytes read/write in the intervalrecords- Number of records processed in the intervalrecsPerSec- Records per second measured over the intervalmbPerSec- Throughput measured in MB per secondavgLatency- Average latency (in PerformanceLogger time unit)minLatency- Minimum latency (in PerformanceLogger time unit)maxLatency- Maximum latency (in PerformanceLogger time unit)invalid- Number of invalid/negative latency measurementslowerDiscard- Number of latencies discarded because they were below the min thresholdhigherDiscard- Number of latencies discarded because they were above the max thresholdslc1- Sliding Latency Coverage metric 1 (implementation-defined)slc2- Sliding Latency Coverage metric 2 (implementation-defined)percentileLatencies- Array of percentile latency values (parallel to percentileLatencyCounts)percentileLatencyCounts- Array of counts for each percentile bucket; may be null
-