Skip to content

Commit

Permalink
rename fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rayz committed Nov 1, 2023
1 parent b9671c3 commit bf4d08c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
11 changes: 6 additions & 5 deletions src/main/java/org/datadog/jmxfetch/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,9 @@ public List<Metric> getMetrics() throws IOException, MalformedObjectNameExceptio
+ " top attributes = " + instanceTelemetryBean.getTopLevelAttributeCount()
+ " metrics = " + instanceTelemetryBean.getMetricCount()
+ " domains queried = " + instanceTelemetryBean.getDomainsQueried()
+ " wildcard query count = " + instanceTelemetryBean.getWildcardQueryCount()
+ " attribute match ratio = " + instanceTelemetryBean.getAttributeMatchRatio());
+ " wildcard domain query count = "
+ instanceTelemetryBean.getWildcardDomainQueryCount()
+ " bean match ratio = " + instanceTelemetryBean.getBeanMatchRatio());
}
return metrics;
}
Expand Down Expand Up @@ -720,7 +721,7 @@ private void getMatchingAttributes() throws IOException {
}
}
if (instanceTelemetryBean != null) {
instanceTelemetryBean.setAttributeMatchRatio((double)
instanceTelemetryBean.setBeanMatchRatio((double)
beansWithAttributeMatch / beans.size());
}
log.info("Found {} matching attributes", matchingAttributes.size());
Expand Down Expand Up @@ -766,8 +767,8 @@ private void refreshBeansList() throws IOException, MalformedObjectNameException
if (this.beans.isEmpty()) {
this.beans = connection.queryNames(null);
if (instanceTelemetryBean != null) {
int wildcardQueryCount = instanceTelemetryBean.getWildcardQueryCount();
instanceTelemetryBean.setWildcardQueryCount(wildcardQueryCount + 1);
int wildcardQueryCount = instanceTelemetryBean.getWildcardDomainQueryCount();
instanceTelemetryBean.setWildcardDomainQueryCount(wildcardQueryCount + 1);
}
}
this.lastRefreshTime = System.currentTimeMillis();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/datadog/jmxfetch/Status.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ private void addStats(
instStats.put("instance_metric_count", instanceTelemetryBean.getMetricCount());
instStats.put("instance_domains_queried", instanceTelemetryBean.getDomainsQueried());
instStats.put("instance_wildcard_query_count",
instanceTelemetryBean.getWildcardQueryCount());
instanceTelemetryBean.getWildcardDomainQueryCount());
instStats.put("instance_attribute_match_ratio",
instanceTelemetryBean.getAttributeMatchRatio());
instanceTelemetryBean.getBeanMatchRatio());
}
instStats.put("message", message);
instStats.put("status", status);
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/org/datadog/jmxfetch/util/InstanceTelemetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ public class InstanceTelemetry implements InstanceTelemetryMBean {
private int topLevelAttributeCount;
private int metricCount;
private int domainsQueried;
private int wildcardQueryCount;
private double attributeMatchRatio;
private int wildcardDomainQueryCount;
private double beanMatchRatio;

/** Jmxfetch telemetry bean constructor. */
public InstanceTelemetry() {
beansFetched = 0;
topLevelAttributeCount = 0;
metricCount = 0;
domainsQueried = 0;
wildcardQueryCount = 0;
attributeMatchRatio = 0.0;
wildcardDomainQueryCount = 0;
beanMatchRatio = 0.0;
}

public int getBeansFetched() {
Expand All @@ -37,12 +37,12 @@ public int getDomainsQueried() {
return domainsQueried;
}

public int getWildcardQueryCount() {
return wildcardQueryCount;
public int getWildcardDomainQueryCount() {
return wildcardDomainQueryCount;
}

public double getAttributeMatchRatio() {
return attributeMatchRatio;
public double getBeanMatchRatio() {
return beanMatchRatio;
}

public void setBeansFetched(int count) {
Expand All @@ -61,12 +61,12 @@ public void setDomainsQueried(int count) {
domainsQueried = count;
}

public void setWildcardQueryCount(int count) {
wildcardQueryCount = count;
public void setWildcardDomainQueryCount(int count) {
wildcardDomainQueryCount = count;
}

public void setAttributeMatchRatio(double ratio) {
attributeMatchRatio = ratio;
public void setBeanMatchRatio(double ratio) {
beanMatchRatio = ratio;
}

}
4 changes: 2 additions & 2 deletions src/test/java/org/datadog/jmxfetch/StatusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void TestStatus() throws IOException {
instance.setMetricCount(fakeMetricCount);
instance.setTopLevelAttributeCount(fakeAttributeCount);
instance.setDomainsQueried(fakeDomainsQueried);
instance.setWildcardQueryCount(fakeWildcardQueryCount);
instance.setAttributeMatchRatio(fakeBeansAttributeMatchRatio);
instance.setWildcardDomainQueryCount(fakeWildcardQueryCount);
instance.setBeanMatchRatio(fakeBeansAttributeMatchRatio);

status.addInstanceStats("fake_check", "fake_instance", 10, 3, "fake_message", Status.STATUS_OK, instance);
status.flush();
Expand Down

0 comments on commit bf4d08c

Please sign in to comment.