@Override
  public void unbindFrom(AbstractMetricService metricService) {
    if (!preCheck()) {
      return;
    }

    metricService.remove(MetricType.AUTO_GAUGE, SystemMetric.JVM_GC_MAX_DATA_SIZE_BYTES.toString());
    metricService.remove(
        MetricType.AUTO_GAUGE, SystemMetric.JVM_GC_LIVE_DATA_SIZE_BYTES.toString());

    if (nonGenerationalMemoryPool != null) {
      metricService.remove(
          MetricType.COUNTER, SystemMetric.JVM_GC_NON_GEN_MEMORY_ALLOCATED_BYTES.toString());
    } else {
      if (oldGenPoolName != null) {
        metricService.remove(
            MetricType.COUNTER, SystemMetric.JVM_GC_MEMORY_PROMOTED_BYTES.toString());
        metricService.remove(
            MetricType.COUNTER, SystemMetric.JVM_GC_OLD_MEMORY_ALLOCATED_BYTES.toString());
      }

      if (firstYoungGenPoolName != null) {
        metricService.remove(
            MetricType.COUNTER, SystemMetric.JVM_GC_YOUNG_MEMORY_ALLOCATED_BYTES.toString());
      }
    }

    // start watching for GC notifications
    for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) {
      if (!(mbean instanceof NotificationEmitter)) {
        continue;
      }
      NotificationListener notificationListener =
          (notification, ref) -> {
            CompositeData cd = (CompositeData) notification.getUserData();
            GarbageCollectionNotificationInfo notificationInfo =
                GarbageCollectionNotificationInfo.from(cd);

            String gcCause = notificationInfo.getGcCause();
            String gcAction = notificationInfo.getGcAction();
            metricService.remove(
                MetricType.TIMER,
                SystemMetric.JVM_GC_PAUSE.toString(),
                "action",
                gcAction,
                "cause",
                gcCause);

            if (mbean.getName().equals("ZGC Cycles")) {
              metricService.remove(
                  MetricType.COUNTER, SystemMetric.JVM_ZGC_CYCLES_COUNT.toString());
            } else if (mbean.getName().equals("ZGC Pauses")) {
              metricService.remove(
                  MetricType.COUNTER, SystemMetric.JVM_ZGC_PAUSES_COUNT.toString());
            }
          };
      NotificationEmitter notificationEmitter = (NotificationEmitter) mbean;
      notificationEmitter.addNotificationListener(
          notificationListener,
          notification ->
              notification
                  .getType()
                  .equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION),
          null);
      notificationListenerCleanUpRunnables.add(
          () -> {
            try {
              notificationEmitter.removeNotificationListener(notificationListener);
            } catch (ListenerNotFoundException ignore) {
              // do nothing
            }
          });
    }
  }
This file is modified from io.micrometer.core.instrument.binder.jvm.JvmGcMetrics
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmGcMetrics.java