@Override
    public Future<?> submit(Runnable runnable) {
        submitted.mark();
        return delegate.submit(new InstrumentedRunnable(runnable));
    }
@Test
    @SuppressWarnings("unchecked")
    public void reportsTasksInformationForForkJoinPool() throws Exception {
        executor = Executors.newWorkStealingPool(4);
        instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "fjp");
        submitted = registry.meter("fjp.submitted");
        running = registry.counter("fjp.running");
        completed = registry.meter("fjp.completed");
        duration = registry.timer("fjp.duration");
        idle = registry.timer("fjp.idle");
        final Gauge<Long> tasksStolen = (Gauge<Long>) registry.getGauges().get("fjp.tasks.stolen");
        final Gauge<Long> tasksQueued = (Gauge<Long>) registry.getGauges().get("fjp.tasks.queued");
        final Gauge<Integer> threadsActive = (Gauge<Integer>) registry.getGauges().get("fjp.threads.active");
        final Gauge<Integer> threadsRunning = (Gauge<Integer>) registry.getGauges().get("fjp.threads.running");

        assertThat(submitted.getCount()).isEqualTo(0);
        assertThat(running.getCount()).isEqualTo(0);
        assertThat(completed.getCount()).isEqualTo(0);
        assertThat(duration.getCount()).isEqualTo(0);
        assertThat(idle.getCount()).isEqualTo(0);
        assertThat(tasksStolen.getValue()).isEqualTo(0L);
        assertThat(tasksQueued.getValue()).isEqualTo(0L);
        assertThat(threadsActive.getValue()).isEqualTo(0);
        assertThat(threadsRunning.getValue()).isEqualTo(0);

        Runnable runnable = () -> {
            assertThat(submitted.getCount()).isEqualTo(1);
            assertThat(running.getCount()).isEqualTo(1);
            assertThat(completed.getCount()).isEqualTo(0);
            assertThat(duration.getCount()).isEqualTo(0);
            assertThat(idle.getCount()).isEqualTo(1);
            assertThat(tasksQueued.getValue()).isEqualTo(0L);
            assertThat(threadsActive.getValue()).isEqualTo(1);
            assertThat(threadsRunning.getValue()).isEqualTo(1);
        };

        Future<?> theFuture = instrumentedExecutorService.submit(runnable);

        assertThat(theFuture).succeedsWithin(Duration.ofSeconds(5L));

        assertThat(submitted.getCount()).isEqualTo(1);
        assertThat(running.getCount()).isEqualTo(0);
        assertThat(completed.getCount()).isEqualTo(1);
        assertThat(duration.getCount()).isEqualTo(1);
        assertThat(duration.getSnapshot().size()).isEqualTo(1);
        assertThat(idle.getCount()).isEqualTo(1);
        assertThat(idle.getSnapshot().size()).isEqualTo(1);
    }