-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AMLII-1360: Creates telemetry bean for Application-level metrics (#505)
* Initial stab at application-level telemetry * Renames telemetry fields to be more specific * Hopefully address linting errors * Fix remaining lint errors * Adds teardown to de-register app telemetry bean * Moves version from bean name to explicitly added tags (plus small refactor for testing) * Tears down application in between each test
- Loading branch information
1 parent
eb8252f
commit ae28d64
Showing
7 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.datadog.jmxfetch.util; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
/** Jmxfetch telemetry JMX MBean. */ | ||
public class AppTelemetry implements AppTelemetryMBean { | ||
private AtomicInteger runningInstanceCount; | ||
private AtomicInteger brokenInstanceCount; | ||
private AtomicInteger brokenInstanceEventCount; | ||
|
||
/** Jmxfetch telemetry bean constructor. */ | ||
public AppTelemetry() { | ||
runningInstanceCount = new AtomicInteger(0); | ||
brokenInstanceCount = new AtomicInteger(0); | ||
brokenInstanceEventCount = new AtomicInteger(0); | ||
} | ||
|
||
public int getRunningInstanceCount() { | ||
return runningInstanceCount.get(); | ||
} | ||
|
||
public int getBrokenInstanceCount() { | ||
return brokenInstanceCount.get(); | ||
} | ||
|
||
public int getBrokenInstanceEventCount() { | ||
return brokenInstanceEventCount.get(); | ||
} | ||
|
||
public void setRunningInstanceCount(int count) { | ||
this.runningInstanceCount.set(count); | ||
} | ||
|
||
public void setBrokenInstanceCount(int count) { | ||
brokenInstanceCount.set(count); | ||
} | ||
|
||
public void incrementBrokenInstanceEventCount() { | ||
brokenInstanceEventCount.incrementAndGet(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/datadog/jmxfetch/util/AppTelemetryMBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.datadog.jmxfetch.util; | ||
|
||
public interface AppTelemetryMBean { | ||
|
||
int getRunningInstanceCount(); | ||
|
||
int getBrokenInstanceCount(); | ||
|
||
int getBrokenInstanceEventCount(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
init_config: | ||
|
||
instances: | ||
- jvm_direct: true | ||
refresh_beans: 4 | ||
collect_default_jvm_metrics: false | ||
name: jmx_test_instance | ||
tags: | ||
- "env:stage" | ||
- "newTag:test" | ||
conf: | ||
- include: | ||
domain: org.datadog.jmxfetch.test |