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 authored and truthbk committed Jan 31, 2019
1 parent a891e58 commit e60ad49
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 @@ -103,7 +103,7 @@ public void sendMetrics(
// 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 @@ -119,8 +119,8 @@ public void sendMetrics(

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 @@ -39,7 +39,7 @@ protected void sendMetricPoint(
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 @@ -745,20 +745,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 e60ad49

Please sign in to comment.