Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep6189 committed Feb 1, 2024
1 parent 4137b63 commit f2f2375
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,6 @@ object PlannerUtil extends StrictLogging {
* @return updated metric name without the last occurence of _bucket
*/
def replaceLastBucketOccurenceStringFromMetricName(metricName: String): String = {
val lastIndexBucket = metricName.lastIndexOf("_bucket")
if (lastIndexBucket > -1) {
metricName.patch(lastIndexBucket, "", 7)
}
else {
metricName
}
metricName.replaceAll("_bucket$", "")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ class PlannerUtilSpec extends AnyFunSpec with Matchers {
}

it(" replaceLastBucketFromMetricName should replace bucket names correctly") {
PlannerUtil.replaceLastBucketFromMetricName("test_metric_bucket") shouldEqual "test_metric"
PlannerUtil.replaceLastBucketFromMetricName("test_bucket_bucket") shouldEqual "test_bucket"
PlannerUtil.replaceLastBucketFromMetricName("my_bucket_bucket_bucket_bucket") shouldEqual
PlannerUtil.replaceLastBucketOccurenceStringFromMetricName("test_metric_bucket") shouldEqual "test_metric"
PlannerUtil.replaceLastBucketOccurenceStringFromMetricName("test_bucket_bucket") shouldEqual "test_bucket"
PlannerUtil.replaceLastBucketOccurenceStringFromMetricName("my_bucket_bucket_bucket_bucket") shouldEqual
"my_bucket_bucket_bucket"
PlannerUtil.replaceLastBucketFromMetricName("testbucket") shouldEqual "testbucket"
PlannerUtil.replaceLastBucketFromMetricName("testBucket_bucket") shouldEqual "testBucket"
PlannerUtil.replaceLastBucketOccurenceStringFromMetricName("testbucket") shouldEqual "testbucket"
PlannerUtil.replaceLastBucketOccurenceStringFromMetricName("testBucket_bucket") shouldEqual "testBucket"
}
}

0 comments on commit f2f2375

Please sign in to comment.