Skip to content

Commit

Permalink
rename jmx check name prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rayz committed Nov 10, 2023
1 parent 1f40ce0 commit 3f089d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/datadog/jmxfetch/JmxAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private List<String> getBeanParametersList(
List<String> beanTags = new ArrayList<String>();
beanTags.add("instance:" + instanceName);
beanTags.add("jmx_domain:" + domain);
beanTags.add("jmx_check_name:" + checkName);
beanTags.add("dd.internal.jmx_check_name:" + checkName);

if (renameCassandraMetrics()) {
beanTags.addAll(getCassandraBeanTags(beanParameters));
Expand Down
38 changes: 19 additions & 19 deletions src/test/java/org/datadog/jmxfetch/TestApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testBeanRegexTags() throws Exception {
"scope:CoolScope",
"instance:jmx_test_instance",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_bean_regex_tags",
"dd.internal.jmx_check_name:jmx_bean_regex_tags",
"bean_host:localhost",
"component",
"hosttag:localhost",
Expand Down Expand Up @@ -67,7 +67,7 @@ public void testBeanTags() throws Exception {
"scope:CoolScope",
"instance:jmx_test_instance",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_bean_tags",
"dd.internal.jmx_check_name:jmx_bean_tags",
"bean_host:localhost",
"component");

Expand Down Expand Up @@ -97,7 +97,7 @@ public void testBeanTagsNormalizeParams() throws Exception {
"scope:CoolScope",
"instance:jmx_test_instance",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_bean_tags_normalize_params",
"dd.internal.jmx_check_name:jmx_bean_tags_normalize_params",
"bean_host:localhost",
"component",
"target_instance:.*example.process.regex.*");
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testBeanTagsDontNormalizeParams() throws Exception {
"scope:\"CoolScope\"",
"instance:jmx_test_instance",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_bean_tags_dont_normalize_params",
"dd.internal.jmx_check_name:jmx_bean_tags_dont_normalize_params",
"bean_host:\"localhost\"",
"component",
"target_instance:\".\\*example.process.regex.\\*\"");
Expand Down Expand Up @@ -156,7 +156,7 @@ public void testRegexpAliasing() throws Exception {
List<String> tags =
Arrays.asList(
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_alias_match",
"dd.internal.jmx_check_name:jmx_alias_match",
"instance:jmx_test_instance1",
"foo:Bar",
"qux:Baz");
Expand Down Expand Up @@ -191,7 +191,7 @@ public void testNoAliasOnDetailedAttribute() throws Exception {
Arrays.asList(
"jmx_domain:org.datadog.jmxfetch.test",
"instance:jmx_test_instance",
"jmx_check_name:jmx_no_alias",
"dd.internal.jmx_check_name:jmx_no_alias",
"foo:Bar",
"qux:Baz");

Expand Down Expand Up @@ -226,7 +226,7 @@ public void testCassandraBean() throws Exception {
"keyspace:MyKeySpace",
"ColumnFamily:MyColumnFamily",
"jmx_domain:org.apache.cassandra.metrics",
"jmx_check_name:jmx_cassandra",
"dd.internal.jmx_check_name:jmx_cassandra",
"instance:jmx_first_instance");

assertMetric("cassandra.pending_tasks.should_be100", tags, 6);
Expand All @@ -238,7 +238,7 @@ public void testCassandraBean() throws Exception {
"scope:MyColumnFamily",
"keyspace:MyKeySpace",
"jmx_domain:org.apache.cassandra.metrics",
"jmx_check_name:jmx_cassandra",
"dd.internal.jmx_check_name:jmx_cassandra",
"instance:jmx_second_instance",
"name:PendingTasks");

Expand Down Expand Up @@ -266,7 +266,7 @@ public void testCassandraDeprecatedBean() throws Exception {
"keyspace:MyKeySpace",
"columnfamily:MyColumnFamily",
"jmx_domain:org.apache.cassandra.db",
"jmx_check_name:jmx_cassandra_deprecated",
"dd.internal.jmx_check_name:jmx_cassandra_deprecated",
"instance:jmx_test_instance");

assertMetric("cassandra.db.should_be100", tags, 6);
Expand Down Expand Up @@ -536,7 +536,7 @@ public void testMetricTypes() throws Exception {
// We test for the presence and the value of the metrics we want to collect
List<String> commonTags =
Arrays.asList("instance:jmx_test_instance", "env:stage", "newTag:test",
"jmx_check_name:jmx_histogram");
"dd.internal.jmx_check_name:jmx_histogram");

// 15 = 13 metrics from java.lang + the 3 collected (gauge and histogram)
assertEquals(16, metrics.size());
Expand Down Expand Up @@ -571,7 +571,7 @@ public void testExcludeTags() throws Exception {
// We test for the presence and the value of the metrics we want to collect.
// Tags "type", "newTag" and "env" should be excluded
List<String> commonTags =
Arrays.asList("instance:jmx_test_instance", "jmx_domain:org.datadog.jmxfetch.test", "jmx_check_name:jmx_exclude_tags");
Arrays.asList("instance:jmx_test_instance", "jmx_domain:org.datadog.jmxfetch.test", "dd.internal.jmx_check_name:jmx_exclude_tags");

// 15 = 13 metrics from java.lang + the 2 collected (gauge and histogram)
assertEquals(15, metrics.size());
Expand All @@ -597,7 +597,7 @@ public void testExcludeServiceTagsAndOverride() throws Exception {
List<String> commonTags =
Arrays.asList("instance:jmx_test_service_override_instance",
"jmx_domain:org.datadog.jmxfetch.test","service:test",
"jmx_check_name:jmx_exclude_tags_override_service");
"dd.internal.jmx_check_name:jmx_exclude_tags_override_service");

// 15 = 13 metrics from java.lang + the 2 collected (gauge and histogram)
assertEquals(15, metrics.size());
Expand All @@ -624,7 +624,7 @@ public void testAdditionalTags() throws Exception {
Arrays.asList(
"instance:jmx_test_instance",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_additional_tags",
"dd.internal.jmx_check_name:jmx_additional_tags",
"type:SimpleTestJavaApp",
"name:testName",
"simple:SimpleTestJavaApp",
Expand Down Expand Up @@ -661,7 +661,7 @@ public void testApp() throws Exception {

// We test for the presence and the value of the metrics we want to collect
List<String> commonTags =
Arrays.asList("instance:jmx_test_instance", "jmx_check_name:jmx", "env:stage", "newTag:test");
Arrays.asList("instance:jmx_test_instance", "dd.internal.jmx_check_name:jmx", "env:stage", "newTag:test");

assertMetric("this.is.100", 100.0, commonTags, Arrays.asList("foo", "gorch", "bar:baz"), 9);
assertMetric(
Expand Down Expand Up @@ -778,7 +778,7 @@ public void testAppCanonicalRate() throws Exception {

// We test for the presence and the value of the metrics we want to collect
List<String> commonTags =
Arrays.asList("instance:jmx_test_instance", "env:stage", "newTag:test", "jmx_check_name:jmx_canonical");
Arrays.asList("instance:jmx_test_instance", "env:stage", "newTag:test", "dd.internal.jmx_check_name:jmx_canonical");

assertMetric("this.is.100", 100.0, commonTags, Arrays.asList("foo", "gorch", "bar:baz"), 9);
assertMetric(
Expand Down Expand Up @@ -977,7 +977,7 @@ public void testServiceDiscovery() throws Exception {
"scope:CoolScope",
"instance:jmx_test_instance2",
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:AD-jmx_0",
"dd.internal.jmx_check_name:AD-jmx_0",
"bean_host:localhost",
"component"
);
Expand All @@ -991,7 +991,7 @@ public void testServiceDiscovery() throws Exception {
"keyspace:MyKeySpace",
"ColumnFamily:MyColumnFamily",
"jmx_domain:org.apache.cassandra.metrics",
"jmx_check_name:AD-cassandra_0",
"dd.internal.jmx_check_name:AD-cassandra_0",
"instance:jmx_first_instance");

assertMetric("cassandra.pending_tasks.should_be100", tags, 6);
Expand All @@ -1003,7 +1003,7 @@ public void testServiceDiscovery() throws Exception {
"scope:MyColumnFamily",
"keyspace:MyKeySpace",
"jmx_domain:org.apache.cassandra.metrics",
"jmx_check_name:AD-cassandra_0",
"dd.internal.jmx_check_name:AD-cassandra_0",
"instance:jmx_second_instance",
"name:PendingTasks");

Expand All @@ -1013,7 +1013,7 @@ public void testServiceDiscovery() throws Exception {
tags =
Arrays.asList(
"jmx_domain:org.datadog.jmxfetch.test",
"jmx_check_name:jmx_alias_match",
"dd.internal.jmx_check_name:jmx_alias_match",
"instance:jmx_test_instance1",
"foo:Bar",
"qux:Baz");
Expand Down

0 comments on commit 3f089d8

Please sign in to comment.