Skip to content

Commit 3b77a83

Browse files
authored
Add dash and slash to the regexp of allowed characters in the pool_name parsing (#623)
1 parent d553998 commit 3b77a83

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect
1111

1212
## unreleased
1313

14+
* [BUGFIX] [#577](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/577) pool_name can include dashes and slashes.
15+
1416
## v0.1.100 [2-25-03-24]
1517
* [ENHANCEMENT] [#620](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/620) Update Dependnecies
1618
* [BUGFIX] [#438](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/438) Add Cassandra 5.1 Agent

management-api-agent-common/src/main/resources/default-metric-settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ relabels:
3434
sourceLabels:
3535
- __origname__
3636
targetLabel: pool_type
37-
- regex: "org\\.apache\\.cassandra\\.metrics\\.ThreadPools\\.(\\w+)\\.(\\w+)\\.(\\w+).*"
37+
- regex: "org\\.apache\\.cassandra\\.metrics\\.ThreadPools\\.(\\w+)\\.(\\w+)\\.([\\w-/]+).*"
3838
replacement: $3
3939
sourceLabels:
4040
- __origname__

management-api-agent-common/src/test/java/io/k8ssandra/metrics/builder/relabel/CassandraMetricsTest.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,39 @@ public void smokeTest() {
6868
assertEquals("Path", threadPoolMetric.getLabelValues().get(0));
6969
assertEquals("ThreadPoolName", threadPoolMetric.getLabelValues().get(1));
7070

71+
// DSE TPC ThreadPool Metrics have dash or slash in the pool_name
72+
CassandraMetricDefinition tpcThreadPoolMetric =
73+
parser.parseDropwizardMetric(
74+
"org.apache.cassandra.metrics.ThreadPools.MetricName.Path.Thread-Pool-Name",
75+
"",
76+
Lists.newArrayList(),
77+
Lists.newArrayList());
78+
assertEquals(
79+
"org_apache_cassandra_metrics_thread_pools_metric_name",
80+
tpcThreadPoolMetric.getMetricName());
81+
assertEquals(2, tpcThreadPoolMetric.getLabelNames().size());
82+
assertEquals(2, tpcThreadPoolMetric.getLabelValues().size());
83+
assertEquals("pool_type", tpcThreadPoolMetric.getLabelNames().get(0));
84+
assertEquals("pool_name", tpcThreadPoolMetric.getLabelNames().get(1));
85+
assertEquals("Path", tpcThreadPoolMetric.getLabelValues().get(0));
86+
assertEquals("Thread-Pool-Name", tpcThreadPoolMetric.getLabelValues().get(1));
87+
88+
CassandraMetricDefinition tpcThreadPoolMetricSlash =
89+
parser.parseDropwizardMetric(
90+
"org.apache.cassandra.metrics.ThreadPools.MetricName.Path.Thread/Pool/Name",
91+
"",
92+
Lists.newArrayList(),
93+
Lists.newArrayList());
94+
assertEquals(
95+
"org_apache_cassandra_metrics_thread_pools_metric_name",
96+
tpcThreadPoolMetricSlash.getMetricName());
97+
assertEquals(2, tpcThreadPoolMetricSlash.getLabelNames().size());
98+
assertEquals(2, tpcThreadPoolMetricSlash.getLabelValues().size());
99+
assertEquals("pool_type", tpcThreadPoolMetricSlash.getLabelNames().get(0));
100+
assertEquals("pool_name", tpcThreadPoolMetricSlash.getLabelNames().get(1));
101+
assertEquals("Path", tpcThreadPoolMetricSlash.getLabelValues().get(0));
102+
assertEquals("Thread/Pool/Name", tpcThreadPoolMetricSlash.getLabelValues().get(1));
103+
71104
// Client Request Metrics
72105
CassandraMetricDefinition clientRequestMetric =
73106
parser.parseDropwizardMetric(

0 commit comments

Comments
 (0)