public void removeRuleMetrics(String ruleId) {
        registry.removeMatching(MetricFilter.startsWith(name(
                rulesPrefix,
                requireNonBlank(ruleId, "ruleId is blank")
        )));
    }
@Test
    void removeRuleMetrics() {
        final var metricRegistry = new MetricRegistry();
        final var registry = PipelineMetricRegistry.create(metricRegistry, "PIPELINE", "RULE");

        registry.registerPipelineMeter("pipeline-1", "executed");
        registry.registerStageMeter("pipeline-1", 7, "executed");
        registry.registerLocalRuleMeter("pipeline-1", 7, "rule-1", "executed");
        registry.registerGlobalRuleMeter("rule-1", "executed");

        assertThat(metricRegistry.getMeters().keySet()).containsExactlyInAnyOrder(
                "RULE.rule-1.executed",
                "RULE.rule-1.pipeline-1.7.executed",
                "PIPELINE.pipeline-1.executed",
                "PIPELINE.pipeline-1.stage.7.executed"
        );

        registry.removeRuleMetrics("rule-1");

        assertThat(metricRegistry.getMeters().keySet()).containsExactlyInAnyOrder(
                "PIPELINE.pipeline-1.executed",
                "PIPELINE.pipeline-1.stage.7.executed"
        );
    }