public static Metric metric(String name) {
        return MetricsImpl.metric(name, Unit.COUNT);
    }
@Test
    public void availableViaJmx() throws Exception {
        int generatedItems = 1000;

        pipeline.readFrom(TestSources.itemStream(1_000))
                .withIngestionTimestamps()
                .filter(l -> l.sequence() < generatedItems)
                .map(t -> {
                    Metrics.metric("total").increment();
                    return t;
                })
                .writeTo(Sinks.noop());

        Job job = instance.getJet().newJob(pipeline, JOB_CONFIG_WITH_METRICS);
        JobMetricsChecker jobMetricsChecker = new JobMetricsChecker(job);
        assertTrueEventually(() -> jobMetricsChecker.assertSummedMetricValue("total", generatedItems));

        long sum = 0;
        int availableProcessors = config.getJetConfig().getCooperativeThreadCount();
        for (int i = 0; i < availableProcessors; i++) {
            JmxMetricsChecker jmxMetricsChecker = JmxMetricsChecker.forExecution(instance, job,
                    "vertex=fused(filter, map)", "procType=TransformP", "proc=" + i, "user=true");
            long attributeValue = jmxMetricsChecker.getMetricValue("total");
            sum += attributeValue;
        }
        assertEquals(generatedItems, sum);
    }