mirror of https://github.com/apache/nifi.git
NIFI-11899 Correct Bulletin Metrics Registry to return latest Bulletins
This closes #7567 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
572e661d12
commit
f8e3b9ebac
|
@ -438,29 +438,10 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
|||
private AuthorizableLookup authorizableLookup;
|
||||
|
||||
// Prometheus Metrics objects
|
||||
private final NiFiMetricsRegistry nifiMetricsRegistry = new NiFiMetricsRegistry();
|
||||
private final JvmMetricsRegistry jvmMetricsRegistry = new JvmMetricsRegistry();
|
||||
private final ConnectionAnalyticsMetricsRegistry connectionAnalyticsMetricsRegistry = new ConnectionAnalyticsMetricsRegistry();
|
||||
private final BulletinMetricsRegistry bulletinMetricsRegistry = new BulletinMetricsRegistry();
|
||||
private final ClusterMetricsRegistry clusterMetricsRegistry = new ClusterMetricsRegistry();
|
||||
|
||||
private final Collection<AbstractMetricsRegistry> configuredRegistries = Arrays.asList(
|
||||
nifiMetricsRegistry,
|
||||
jvmMetricsRegistry,
|
||||
connectionAnalyticsMetricsRegistry,
|
||||
bulletinMetricsRegistry,
|
||||
clusterMetricsRegistry
|
||||
);
|
||||
|
||||
private final Collection<CollectorRegistry> metricsRegistries = Arrays.asList(
|
||||
nifiMetricsRegistry.getRegistry(),
|
||||
jvmMetricsRegistry.getRegistry(),
|
||||
connectionAnalyticsMetricsRegistry.getRegistry(),
|
||||
bulletinMetricsRegistry.getRegistry(),
|
||||
clusterMetricsRegistry.getRegistry()
|
||||
);
|
||||
|
||||
|
||||
// -----------------------------------------
|
||||
// Synchronization methods
|
||||
// -----------------------------------------
|
||||
|
@ -6038,12 +6019,14 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
|||
return entityFactory.createProcessorDiagnosticsEntity(dto, revisionDto, permissionsDto, processorStatusDto, bulletins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollectorRegistry> generateFlowMetrics() {
|
||||
protected Collection<AbstractMetricsRegistry> populateFlowMetrics() {
|
||||
// Include registries which are fully refreshed upon each invocation
|
||||
NiFiMetricsRegistry nifiMetricsRegistry = new NiFiMetricsRegistry();
|
||||
BulletinMetricsRegistry bulletinMetricsRegistry = new BulletinMetricsRegistry();
|
||||
|
||||
final String instanceId = StringUtils.isEmpty(controllerFacade.getInstanceId()) ? "" : controllerFacade.getInstanceId();
|
||||
ProcessGroupStatus rootPGStatus = controllerFacade.getProcessGroupStatus("root");
|
||||
|
||||
nifiMetricsRegistry.clear();
|
||||
PrometheusMetricsUtil.createNifiMetrics(nifiMetricsRegistry, rootPGStatus, instanceId, "", ROOT_PROCESS_GROUP,
|
||||
PrometheusMetricsUtil.METRICS_STRATEGY_COMPONENTS.getValue());
|
||||
|
||||
|
@ -6142,10 +6125,24 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
|||
final boolean isClustered = clusterCoordinator != null;
|
||||
final boolean isConnectedToCluster = isClustered() && clusterCoordinator.isConnected();
|
||||
PrometheusMetricsUtil.createClusterMetrics(clusterMetricsRegistry, instanceId, isClustered, isConnectedToCluster, connectedNodesLabel, connectedNodeCount, totalNodeCount);
|
||||
Collection<AbstractMetricsRegistry> metricsRegistries = Arrays.asList(
|
||||
nifiMetricsRegistry,
|
||||
jvmMetricsRegistry,
|
||||
connectionAnalyticsMetricsRegistry,
|
||||
bulletinMetricsRegistry,
|
||||
clusterMetricsRegistry
|
||||
);
|
||||
|
||||
return metricsRegistries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollectorRegistry> generateFlowMetrics() {
|
||||
|
||||
return populateFlowMetrics().stream().map(AbstractMetricsRegistry::getRegistry)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollectorRegistry> generateFlowMetrics(final Set<FlowMetricsRegistry> includeRegistries) {
|
||||
final Set<FlowMetricsRegistry> selectedRegistries = includeRegistries.isEmpty() ? new HashSet<>(Arrays.asList(FlowMetricsRegistry.values())) : includeRegistries;
|
||||
|
@ -6154,7 +6151,8 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
|||
.map(FlowMetricsRegistry::getRegistryClass)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
generateFlowMetrics();
|
||||
Collection<AbstractMetricsRegistry> configuredRegistries = populateFlowMetrics();
|
||||
|
||||
return configuredRegistries.stream()
|
||||
.filter(configuredRegistry -> registryClasses.contains(configuredRegistry.getClass()))
|
||||
.map(AbstractMetricsRegistry::getRegistry)
|
||||
|
|
Loading…
Reference in New Issue