public List collect()

in seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/telemetry/metrics/exports/NodeMetricExports.java [37:343]


    public List<MetricFamilySamples> collect() {
        List<MetricFamilySamples> mfs = new ArrayList();
        // instance state
        nodeState(mfs);

        InstanceMBean instanceMBean = getManagementService().getInstanceMBean();
        if (instanceMBean == null) {
            return mfs;
        }

        // node hazelcast executor
        String address = localAddress();
        List<String> labelNames = clusterLabelNames(ADDRESS, "type");
        GaugeMetricFamily isShutdownMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_isShutdown",
                        "The hazelcast executor isShutdown of seatunnel cluster node",
                        labelNames);
        GaugeMetricFamily isTerminatedMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_isTerminated",
                        "The hazelcast executor isTerminated of seatunnel cluster node",
                        labelNames);

        GaugeMetricFamily maxPoolSizeMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_maxPoolSize",
                        "The hazelcast executor maxPoolSize of seatunnel cluster node",
                        labelNames);

        GaugeMetricFamily poolSizeMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_poolSize",
                        "The hazelcast executor poolSize of seatunnel cluster node",
                        labelNames);

        GaugeMetricFamily queueRemainingCapacityMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_queueRemainingCapacity",
                        "The hazelcast executor queueRemainingCapacity of seatunnel cluster ",
                        labelNames);

        GaugeMetricFamily queueSizeMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_queueSize",
                        "The hazelcast executor queueSize of seatunnel cluster node",
                        labelNames);

        GaugeMetricFamily executedCountMetricFamily =
                new GaugeMetricFamily(
                        "hazelcast_executor_executedCount",
                        "The hazelcast executor executedCount of seatunnel cluster node",
                        labelNames);

        List<String> asyncValues = labelValues(address, "async");
        List<String> clientBlockingValues = labelValues(address, "clientBlocking");
        List<String> clientExecutorValues = labelValues(address, "client");
        List<String> clientQueryValues = labelValues(address, "clientQuery");
        List<String> ioValues = labelValues(address, "io");
        List<String> offloadableValues = labelValues(address, "offloadable");
        List<String> scheduledValues = labelValues(address, "scheduled");
        List<String> systemValues = labelValues(address, "system");

        // Executor executedCount
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getAsyncExecutorMBean().getExecutedCount(),
                asyncValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getClientExecutorMBean().getExecutedCount(),
                clientExecutorValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().getExecutedCount(),
                clientBlockingValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().getExecutedCount(),
                clientQueryValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getIoExecutorMBean().getExecutedCount(),
                ioValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().getExecutedCount(),
                offloadableValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getScheduledExecutorMBean().getExecutedCount(),
                scheduledValues);
        longMetric(
                executedCountMetricFamily,
                instanceMBean.getSystemExecutorMBean().getExecutedCount(),
                systemValues);
        mfs.add(executedCountMetricFamily);

        // Executor isShutdown
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getAsyncExecutorMBean().isShutdown() ? 1 : 0,
                asyncValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getClientExecutorMBean().isShutdown() ? 1 : 0,
                clientExecutorValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().isShutdown() ? 1 : 0,
                clientBlockingValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().isShutdown() ? 1 : 0,
                clientQueryValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getIoExecutorMBean().isShutdown() ? 1 : 0,
                ioValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().isShutdown() ? 1 : 0,
                offloadableValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getScheduledExecutorMBean().isShutdown() ? 1 : 0,
                scheduledValues);
        intMetric(
                isShutdownMetricFamily,
                instanceMBean.getSystemExecutorMBean().isShutdown() ? 1 : 0,
                systemValues);
        mfs.add(isShutdownMetricFamily);

        // Executor isTerminated
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getAsyncExecutorMBean().isTerminated() ? 1 : 0,
                asyncValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getClientExecutorMBean().isTerminated() ? 1 : 0,
                clientExecutorValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().isTerminated() ? 1 : 0,
                clientBlockingValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().isTerminated() ? 1 : 0,
                clientQueryValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getIoExecutorMBean().isTerminated() ? 1 : 0,
                ioValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().isTerminated() ? 1 : 0,
                offloadableValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getScheduledExecutorMBean().isTerminated() ? 1 : 0,
                scheduledValues);
        intMetric(
                isTerminatedMetricFamily,
                instanceMBean.getSystemExecutorMBean().isTerminated() ? 1 : 0,
                systemValues);
        mfs.add(isTerminatedMetricFamily);

        // Executor maxPoolSize
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getAsyncExecutorMBean().maxPoolSize(),
                asyncValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getClientExecutorMBean().maxPoolSize(),
                clientExecutorValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().maxPoolSize(),
                clientBlockingValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().maxPoolSize(),
                clientQueryValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getIoExecutorMBean().maxPoolSize(),
                ioValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().maxPoolSize(),
                offloadableValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getScheduledExecutorMBean().maxPoolSize(),
                scheduledValues);
        intMetric(
                maxPoolSizeMetricFamily,
                instanceMBean.getSystemExecutorMBean().maxPoolSize(),
                systemValues);
        mfs.add(maxPoolSizeMetricFamily);

        // Executor poolSize
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getAsyncExecutorMBean().poolSize(),
                asyncValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getClientExecutorMBean().poolSize(),
                clientExecutorValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().poolSize(),
                clientBlockingValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().poolSize(),
                clientQueryValues);
        intMetric(poolSizeMetricFamily, instanceMBean.getIoExecutorMBean().poolSize(), ioValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().poolSize(),
                offloadableValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getScheduledExecutorMBean().poolSize(),
                scheduledValues);
        intMetric(
                poolSizeMetricFamily,
                instanceMBean.getSystemExecutorMBean().poolSize(),
                systemValues);
        mfs.add(poolSizeMetricFamily);

        // Executor queueRemainingCapacity
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getAsyncExecutorMBean().queueRemainingCapacity(),
                asyncValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getClientExecutorMBean().queueRemainingCapacity(),
                clientExecutorValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().queueRemainingCapacity(),
                clientBlockingValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().queueRemainingCapacity(),
                clientQueryValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getIoExecutorMBean().queueRemainingCapacity(),
                ioValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().queueRemainingCapacity(),
                offloadableValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getScheduledExecutorMBean().queueRemainingCapacity(),
                scheduledValues);
        intMetric(
                queueRemainingCapacityMetricFamily,
                instanceMBean.getSystemExecutorMBean().queueRemainingCapacity(),
                systemValues);
        mfs.add(queueRemainingCapacityMetricFamily);

        // Executor queueSize
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getAsyncExecutorMBean().queueSize(),
                asyncValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getClientExecutorMBean().queueSize(),
                clientExecutorValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getClientBlockingExecutorMBean().queueSize(),
                clientBlockingValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getClientQueryExecutorMBean().queueSize(),
                clientQueryValues);
        intMetric(queueSizeMetricFamily, instanceMBean.getIoExecutorMBean().queueSize(), ioValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getOffloadableExecutorMBean().queueSize(),
                offloadableValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getScheduledExecutorMBean().queueSize(),
                scheduledValues);
        intMetric(
                queueSizeMetricFamily,
                instanceMBean.getSystemExecutorMBean().queueSize(),
                systemValues);
        mfs.add(queueSizeMetricFamily);

        // partition metric
        partitionMetric(instanceMBean.getPartitionServiceMBean(), mfs, address);

        return mfs;
    }