@Test
  public void testExistenceOfVMStats() {
    String regionName = "region_1";
    VM vm = getHost(0).getVM(0);

    vm.invoke(() -> {
      Properties props = new Properties();
      props.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
      props.setProperty(STATISTIC_SAMPLE_RATE, "1000");

      InternalDistributedSystem system = getSystem(props);

      // assert that sampler is working as expected
      GemFireStatSampler sampler = system.getStatSampler();
      assertThat(sampler.isSamplingEnabled()).isTrue();
      assertThat(sampler.isAlive()).isTrue();

      await("awaiting SampleCollector to exist")
          .until(() -> sampler.getSampleCollector() != null);

      SampleCollector sampleCollector = sampler.getSampleCollector();
      assertThat(sampleCollector).isNotNull();

      StatisticsType VMStatsType = getSystem().findType("VMStats");
      Statistics vmStats = getSystem().findStatisticsByType(VMStatsType)[0];

      assertThatNoException().isThrownBy(() -> vmStats.get("pendingFinalization"));
      assertThatNoException().isThrownBy(() -> vmStats.get("loadedClasses"));
      assertThatNoException().isThrownBy(() -> vmStats.get("unloadedClasses"));
      assertThatNoException().isThrownBy(() -> vmStats.get("daemonThreads"));
      assertThatNoException().isThrownBy(() -> vmStats.get("peakThreads"));
      assertThatNoException().isThrownBy(() -> vmStats.get("threads"));
      assertThatNoException().isThrownBy(() -> vmStats.get("threadStarts"));
      assertThatNoException().isThrownBy(() -> vmStats.get("cpus"));
      assertThatNoException().isThrownBy(() -> vmStats.get("freeMemory"));
      assertThatNoException().isThrownBy(() -> vmStats.get("totalMemory"));
      assertThatNoException().isThrownBy(() -> vmStats.get("maxMemory"));
      assertThatNoException().isThrownBy(() -> vmStats.get("processCpuTime"));
      assertThatNoException().isThrownBy(() -> vmStats.get("fdsOpen"));
      assertThatNoException().isThrownBy(() -> vmStats.get("fdLimit"));
    });
  }
Distributed tests for {@link Statistics}.

<p>
VM0 performs puts and VM1 receives updates. Both use custom statistics for start/end with
increment to add up puts and updates. Then validation tests values in stat resource instances and
uses StatArchiveReader. Both are tested against static counters in both VMs.

<p>
This test mimics hydratest/locators/cacheDS.conf in an attempt to reproduce bug #45478. So far
this test passes consistently.

@since GemFire 7.0
geode-core/src/distributedTest/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java