コード例 #1
0
  static {
    String statName = "DiskDirStatistics";
    String statDescription = "Statistics about a single disk directory for a region";

    final String diskSpaceDesc =
        "The total number of bytes currently being used on disk in this directory for oplog files.";
    final String maxSpaceDesc =
        "The configured maximum number of bytes allowed in this directory for oplog files. Note that some product configurations allow this maximum to be exceeded.";
    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();

    type =
        f.createType(
            statName,
            statDescription,
            new StatisticDescriptor[] {
              f.createLongGauge("diskSpace", diskSpaceDesc, "bytes"),
              f.createLongGauge("maximumSpace", maxSpaceDesc, "bytes"),
              f.createLongGauge(
                  "volumeSize", "The total size in bytes of the disk volume", "bytes"),
              f.createLongGauge(
                  "volumeFreeSpace", "The total free space in bytes on the disk volume", "bytes"),
              f.createLongCounter(
                  "volumeFreeSpaceChecks", "The total number of disk space checks", "checks"),
              f.createLongCounter(
                  "volumeFreeSpaceTime", "The total time spent checking disk usage", "nanoseconds")
            });

    // Initialize id fields
    diskSpaceId = type.nameToId("diskSpace");
    maxSpaceId = type.nameToId("maximumSpace");
    volumeSizeId = type.nameToId("volumeSize");
    volumeFreeSpaceId = type.nameToId("volumeFreeSpace");
    volumeFreeSpaceChecksId = type.nameToId("volumeFreeSpaceChecks");
    volumeFreeSpaceTimeId = type.nameToId("volumeFreeSpaceTime");
  }
コード例 #2
0
 private static void checkOffset(String name, int offset) {
   int id = myType.nameToId(name);
   Assert.assertTrue(
       offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
 }