Skip to content

Commit

Permalink
rename to monotonic_count, remove cannonicalRate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arbll committed Dec 12, 2018
1 parent b5365bd commit 93b66d0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/datadog/jmxfetch/reporter/Reporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void sendMetrics(LinkedList<HashMap<String, Object>> metrics, String inst
// StatsD doesn't support rate metrics so we need to have our own aggregator to compute rates
if ("gauge".equals(metricType) || "histogram".equals(metricType)) {
sendMetricPoint(metricType, metricName, currentValue, tags);
} else if ("count".equals(metricType)) {
} else if ("monotonic_count".equals(metricType)) {
String key = generateId(metric);
if (!instanceCountersAggregator.containsKey(key)) {
instanceCountersAggregator.put(key, currentValue.longValue());
Expand All @@ -100,8 +100,8 @@ public void sendMetrics(LinkedList<HashMap<String, Object>> metrics, String inst

instanceCountersAggregator.put(key, currentValue.longValue());

if (delta < 0 && canonicalRate) {
LOGGER.info("Counter " + metricName + " has been reset and canonical rate is enabled - not submitting.");
if (delta < 0) {
LOGGER.info("Counter " + metricName + " has been reset - not submitting.");
continue;
}
sendMetricPoint(metricType, metricName, delta, tags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected void sendMetricPoint(String metricType, String metricName, double valu
this.statsDClient.stop();
init();
}
if (metricType.equals("count")) {
if (metricType.equals("monotonic_count")) {
statsDClient.count(metricName, (long) value, tags);
} else if (metricType.equals("histogram")) {
statsDClient.histogram(metricName, value, tags);
Expand Down
14 changes: 0 additions & 14 deletions src/test/java/org/datadog/jmxfetch/TestApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -741,20 +741,6 @@ public void testAppCount() throws Exception {
assertEquals(14, metrics.size());
assertMetric("test.counter", 5, Collections.<String>emptyList(), 3);

// For the 4th collection we decrement the count by 8 so we should get a -8 delta
testApp.decrementCounter(8);
run();
metrics = getMetrics();
assertEquals(14, metrics.size());
assertMetric("test.counter", -8, Collections.<String>emptyList(), 3);

// For the 5th collection we increment the count by 3 so we should get a +3 delta
testApp.incrementCounter(3);
run();
metrics = getMetrics();
assertEquals(14, metrics.size());
assertMetric("test.counter", 3, Collections.<String>emptyList(), 3);

assertCoverage();
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/jmx_count.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ instances:
domain: org.datadog.jmxfetch.test
attribute:
ShouldBeCounter:
metric_type: count
metric_type: monotonic_count
alias: test.counter

0 comments on commit 93b66d0

Please sign in to comment.