Skip to content

Commit

Permalink
prepare release documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-bukhtoyarov committed Nov 8, 2016
1 parent 7a9bc0d commit abad8ee
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
The library contains collection of advanced metrics which missed in the original [Metrics Core](https://dropwizard.github.io/metrics/3.1.0/manual/core/) such as:
* Rolling time window counters. [See documentation for counters](counters.md).
* Rolling time window hit-ratio. [See documentation for hit-ratio](hit-ratio.md).
* Histograms with loss-less capturing. [See documentation for histograms](histograms.md).
* Top of queries by latency. [See documentation for top](top.md).
* Loss-less capturing histograms(based on HdrHistogram). [See documentation for histograms](histograms.md).

## Build status
[![Build Status](https://travis-ci.org/vladimir-bukhtoyarov/metrics-core-hdr.svg?branch=master)](https://travis-ci.org/vladimir-bukhtoyarov/metrics-core-hdr)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>com.github.metrics-core-addons</groupId>
<artifactId>metrics-core-hdr</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>

<packaging>jar</packaging>
<name>Metrics-Core-HDR</name>
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/com/github/metricscore/hdr/top/TopMetricSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,43 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
* The adapter to use {@link Top} with {@link com.codahale.metrics.MetricRegistry}.
* <p>
* <p><b>Sample Usage:</b>
* <pre> {@code
*
* Top top = Top.builder(3).resetAllPositionsOnSnapshot().build();
* MetricSet metricSet = new TopMetricSet("my-top", top, TimeUnit.MILLISECONDS, 5);
* registry.registerAll(metricSet);
* }</pre>
* The code above creates 7 gauges with following names:
* <ul>
* <li>my-top.latencyUnit</li>
* <li>my-top.0.latency</li>
* <li>my-top.0.description</li>
* <li>my-top.1.latency</li>
* <li>my-top.1.description</li>
* <li>my-top.2.latency</li>
* <li>my-top.2.description</li>
* </ul>
* The "latency" gauges have {@link BigDecimal} type, the "latencyUnit" and "description" gauges have {@link String} type.
* The number in the gauge name represents position in the top in descending order, the "0" is the slowest query.
* </p>
*/
public class TopMetricSet implements MetricSet {

private final BigDecimal zero;
private final Map<String, Metric> gauges;

/**
* Creates new collection of gauges which compatible with {@link com.codahale.metrics.MetricRegistry}.
*
* @param name the name prefix for each gauge
* @param top the target {@link Top}
* @param latencyUnit the time unit to convert latency
* @param digitsAfterDecimalPoint the number of digits after decimal point
*/
public TopMetricSet(String name, Top top, TimeUnit latencyUnit, int digitsAfterDecimalPoint) {
if (name == null) {
throw new IllegalArgumentException("name should not be null");
Expand Down

0 comments on commit abad8ee

Please sign in to comment.