[ 
https://issues.apache.org/jira/browse/NIFI-4849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395671#comment-16395671
 ] 

ASF GitHub Bot commented on NIFI-4849:
--------------------------------------

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.


> Add REST Endpoint for gathering Processor Diagnostics information
> -----------------------------------------------------------------
>
>                 Key: NIFI-4849
>                 URL: https://issues.apache.org/jira/browse/NIFI-4849
>             Project: Apache NiFi
>          Issue Type: Sub-task
>          Components: Core Framework
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Major
>             Fix For: 1.6.0
>
>
> We need to add a REST endpoint that will use the appropriate resources to 
> gather the Processor Diagnostics information. Information to return should 
> include things like:
>  * Processor config
>  * Processor status
>  * Garbage Collection info
>  * Repo Sizes
>  * Connection info for connections whose source or destination is the 
> processor
>  * Controller Services that the processor is referencing



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to