mirror of https://github.com/apache/nifi.git
NIFI-8073 Correcting isBackPressureEnabled in PrometheusMetricsUtil
This commit is contained in:
parent
d7ca4c920c
commit
039a09923a
|
@ -17,11 +17,7 @@
|
||||||
|
|
||||||
package org.apache.nifi.prometheus.util;
|
package org.apache.nifi.prometheus.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import io.prometheus.client.CollectorRegistry;
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import io.prometheus.client.SimpleCollector;
|
import io.prometheus.client.SimpleCollector;
|
||||||
import org.apache.nifi.components.AllowableValue;
|
import org.apache.nifi.components.AllowableValue;
|
||||||
import org.apache.nifi.components.PropertyDescriptor;
|
import org.apache.nifi.components.PropertyDescriptor;
|
||||||
|
@ -29,8 +25,6 @@ import org.apache.nifi.controller.status.ConnectionStatus;
|
||||||
import org.apache.nifi.controller.status.PortStatus;
|
import org.apache.nifi.controller.status.PortStatus;
|
||||||
import org.apache.nifi.controller.status.ProcessGroupStatus;
|
import org.apache.nifi.controller.status.ProcessGroupStatus;
|
||||||
import org.apache.nifi.controller.status.ProcessorStatus;
|
import org.apache.nifi.controller.status.ProcessorStatus;
|
||||||
|
|
||||||
import io.prometheus.client.CollectorRegistry;
|
|
||||||
import org.apache.nifi.controller.status.RemoteProcessGroupStatus;
|
import org.apache.nifi.controller.status.RemoteProcessGroupStatus;
|
||||||
import org.apache.nifi.controller.status.TransmissionStatus;
|
import org.apache.nifi.controller.status.TransmissionStatus;
|
||||||
import org.apache.nifi.controller.status.analytics.StatusAnalytics;
|
import org.apache.nifi.controller.status.analytics.StatusAnalytics;
|
||||||
|
@ -40,6 +34,11 @@ import org.apache.nifi.processor.DataUnit;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.util.StringUtils;
|
import org.apache.nifi.util.StringUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class PrometheusMetricsUtil {
|
public class PrometheusMetricsUtil {
|
||||||
|
|
||||||
public static final AllowableValue METRICS_STRATEGY_ROOT = new AllowableValue("Root Process Group", "Root Process Group",
|
public static final AllowableValue METRICS_STRATEGY_ROOT = new AllowableValue("Root Process Group", "Root Process Group",
|
||||||
|
@ -226,7 +225,7 @@ public class PrometheusMetricsUtil {
|
||||||
"PERCENT_USED_COUNT", instanceId, connComponentType, connComponentName, connComponentId, parentId, sourceId, sourceName, destinationId, destinationName);
|
"PERCENT_USED_COUNT", instanceId, connComponentType, connComponentName, connComponentId, parentId, sourceId, sourceName, destinationId, destinationName);
|
||||||
|
|
||||||
boolean isBackpressureEnabled = (connectionStatus.getBackPressureObjectThreshold() > 0 && connectionStatus.getBackPressureObjectThreshold() <= connectionStatus.getQueuedCount())
|
boolean isBackpressureEnabled = (connectionStatus.getBackPressureObjectThreshold() > 0 && connectionStatus.getBackPressureObjectThreshold() <= connectionStatus.getQueuedCount())
|
||||||
|| (connectionStatus.getBackPressureBytesThreshold() > 0 && connectionStatus.getBackPressureBytesThreshold() <= connectionStatus.getMaxQueuedBytes());
|
|| (connectionStatus.getBackPressureBytesThreshold() > 0 && connectionStatus.getBackPressureBytesThreshold() <= connectionStatus.getQueuedBytes());
|
||||||
nifiMetricsRegistry.setDataPoint(isBackpressureEnabled ? 1 : 0, "IS_BACKPRESSURE_ENABLED",
|
nifiMetricsRegistry.setDataPoint(isBackpressureEnabled ? 1 : 0, "IS_BACKPRESSURE_ENABLED",
|
||||||
instanceId, connComponentType, connComponentName, connComponentId, parentId, sourceId, sourceName, destinationId, destinationName);
|
instanceId, connComponentType, connComponentName, connComponentId, parentId, sourceId, sourceName, destinationId, destinationName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue