Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2468#discussion_r173902301
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
---
@@ -4506,6 +4515,123 @@ public ComponentHistoryDTO
getComponentHistory(final String componentId) {
return history;
}
+ private ControllerServiceEntity createControllerServiceEntity(final
String serviceId, final NiFiUser user) {
+ final ControllerServiceNode serviceNode =
controllerServiceDAO.getControllerService(serviceId);
+ return createControllerServiceEntity(serviceNode,
Collections.emptySet(), user);
+ }
+
+ @Override
+ public ProcessorDiagnosticsEntity getProcessorDiagnostics(final String
id) {
+ final ProcessorNode processor = processorDAO.getProcessor(id);
+ final ProcessorStatus processorStatus =
controllerFacade.getProcessorStatus(id);
+
+ // Generate Processor Diagnostics
+ final NiFiUser user = NiFiUserUtils.getNiFiUser();
+ final ProcessorDiagnosticsDTO dto =
controllerFacade.getProcessorDiagnostics(processor, processorStatus,
bulletinRepository, serviceId -> createControllerServiceEntity(serviceId,
user));
+
+ // Filter anything out of diagnostics that the user is not
authorized to see.
+ final List<JVMDiagnosticsSnapshotDTO> jvmDiagnosticsSnaphots = new
ArrayList<>();
+ final JVMDiagnosticsDTO jvmDiagnostics = dto.getJvmDiagnostics();
+ jvmDiagnosticsSnaphots.add(jvmDiagnostics.getAggregateSnapshot());
+
+ // filter controller-related information
+ final boolean canReadController =
authorizableLookup.getController().isAuthorized(authorizer, RequestAction.READ,
user);
+ if (!canReadController) {
+ for (final JVMDiagnosticsSnapshotDTO snapshot :
jvmDiagnosticsSnaphots) {
--- End diff --
I don't think that active event & timer driven threads need to be filtered
because they are available to anyone with access to /flow. I also feel like
uptime should be available. I could see an argument for the elected primary &
coordinator not being included, but I went back and forth on that a bit
personally, because currently that info is not exposed anywhere except if you
have that permissions. It seemed quite benign to me to include this, but If you
think they should be removed I am okay with it.
---