protected void deriveNodeDetails ( Trace trace , List < Node > nodes , List < NodeDetails > rts , boolean initial , Set < Property > commonProperties ) { for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { Node n = nodes . get ( i ) ; // If consumer or producer, check that endpoint type has been set, // otherwise indicates internal communication between spawned // fragments, which should not be recorded as nodes, as they will // distort derived statistics. See HWKBTM-434. boolean ignoreNode = false ; boolean ignoreChildNodes = false ; if ( n . getClass ( ) == Consumer . class && ( ( Consumer ) n ) . getEndpointType ( ) == null ) { ignoreNode = true ; } else if ( n . getClass ( ) == Producer . class && ( ( Producer ) n ) . getEndpointType ( ) == null ) { ignoreNode = true ; ignoreChildNodes = true ; } if ( ! ignoreNode ) { NodeDetails nd = new NodeDetails ( ) ; nd . setId ( UUID . randomUUID ( ) . toString ( ) ) ; nd . setTraceId ( trace . getTraceId ( ) ) ; nd . setFragmentId ( trace . getFragmentId ( ) ) ; nd . setTransaction ( trace . getTransaction ( ) ) ; nd . setCorrelationIds ( n . getCorrelationIds ( ) ) ; nd . setElapsed ( n . getDuration ( ) ) ; nd . setActual ( calculateActualTime ( n ) ) ; if ( n . getType ( ) == NodeType . Component ) { nd . setComponentType ( ( ( Component ) n ) . getComponentType ( ) ) ; } else { nd . setComponentType ( n . getType ( ) . name ( ) ) ; } if ( trace . getHostName ( ) != null && ! trace . getHostName ( ) . trim ( ) . isEmpty ( ) ) { nd . setHostName ( trace . getHostName ( ) ) ; } // Interim solution before discussion HWKAPM-778 resolved. Previously // all NodeDetails derived from a fragment had all of the properties in the // fragment, but this has now been changed so that only the initial node // associated with a fragment will have all the properties for the fragment, // to add filtering for construction of the service dependency diagram. if ( initial ) { nd . setProperties ( trace . allProperties ( ) ) ; nd . setInitial ( true ) ; } else { nd . getProperties ( ) . addAll ( n . getProperties ( ) ) ; nd . getProperties ( ) . addAll ( commonProperties ) ; } nd . setTimestamp ( n . getTimestamp ( ) ) ; nd . setType ( n . getType ( ) ) ; nd . setUri ( n . getUri ( ) ) ; nd . setOperation ( n . getOperation ( ) ) ; rts . add ( nd ) ; } initial = false ; if ( ! ignoreChildNodes && n . interactionNode ( ) ) { deriveNodeDetails ( trace , ( ( InteractionNode ) n ) . getNodes ( ) , rts , initial , commonProperties ) ; } } }
This method recursively derives the node details metrics for the supplied nodes .