idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
133,100
protected void initFollowsFrom ( APMSpanBuilder builder , TraceRecorder recorder , Reference ref , ContextSampler sampler ) { APMSpan referenced = ( APMSpan ) ref . getReferredTo ( ) ; initTopLevelState ( referenced . getTraceContext ( ) . getTopSpan ( ) , recorder , sampler ) ; String nodeId = referenced . getNodePath...
This method initialises the span based on a follows - from relationship .
133,101
protected void processNoPrimaryReference ( APMSpanBuilder builder , TraceRecorder recorder , ContextSampler sampler ) { initTopLevelState ( this , recorder , sampler ) ; Set < String > traceIds = builder . references . stream ( ) . map ( ref -> { if ( ref . getReferredTo ( ) instanceof APMSpan ) { return ( ( APMSpan ) ...
This method initialises the span based on there being no primary reference .
133,102
protected void processRemainingReferences ( APMSpanBuilder builder , Reference primaryRef ) { for ( Reference ref : builder . references ) { if ( primaryRef == ref ) { continue ; } if ( ref . getReferredTo ( ) instanceof APMSpan ) { APMSpan referenced = ( APMSpan ) ref . getReferredTo ( ) ; String nodeId = referenced ....
This method processes the remaining references by creating appropriate correlation ids against the current node .
133,103
public void init ( String txn , TransactionConfig btc ) { if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "ProcessManager: initialise btxn '" + txn + "' config=" + btc + " processors=" + btc . getProcessors ( ) . size ( ) ) ; } if ( btc . getProcessors ( ) != null && ! btc . getProcessors ( ) . isEmpty ( ) ) { ...
This method initialises the processors associated with the supplied transaction configuration .
133,104
public void process ( Trace trace , Node node , Direction direction , Map < String , ? > headers , Object ... values ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "ProcessManager: process trace=" + trace + " node=" + node + " direction=" + direction + " headers=" + headers + " values=" + values + " : ...
This method processes the supplied information against the configured processor details for the trace .
133,105
public static String toUnique ( Span span ) { String id = span . getId ( ) ; if ( span . clientSpan ( ) ) { id = getClientId ( span . getId ( ) ) ; } return id ; }
Utility method to get unique id of the span . Note that method does not change the span id .
133,106
protected void doPublish ( String tenantId , List < T > items , String subscriber , int retryCount , long delay ) throws Exception { String data = mapper . writeValueAsString ( items ) ; TextMessage tm = session . createTextMessage ( data ) ; if ( tenantId != null ) { tm . setStringProperty ( "tenant" , tenantId ) ; } ...
This method publishes the supplied items .
133,107
protected void init ( ) { Properties props = new Properties ( ) ; props . put ( "bootstrap.servers" , PropertyUtil . getProperty ( PropertyUtil . HAWKULAR_APM_URI_PUBLISHER , PropertyUtil . getProperty ( PropertyUtil . HAWKULAR_APM_URI ) ) . substring ( PropertyUtil . KAFKA_PREFIX . length ( ) ) ) ; props . put ( "acks...
This method initialises the publisher .
133,108
public Criteria addProperty ( String name , String value , Operator operator ) { properties . add ( new PropertyCriteria ( name , value , operator ) ) ; return this ; }
This method adds a new property criteria .
133,109
public boolean transactionWide ( ) { return ! ( ! properties . isEmpty ( ) || ! correlationIds . isEmpty ( ) || hostName != null || uri != null || operation != null ) ; }
This method determines if the specified criteria are relevant to all fragments within an end to end transaction .
133,110
public Criteria deriveTransactionWide ( ) { Criteria ret = new Criteria ( ) ; ret . setStartTime ( startTime ) ; ret . setEndTime ( endTime ) ; ret . setProperties ( getProperties ( ) . stream ( ) . filter ( p -> p . getName ( ) . equals ( Constants . PROP_PRINCIPAL ) ) . collect ( Collectors . toSet ( ) ) ) ; ret . se...
This method returns the transaction wide version of the current criteria .
133,111
public static CollectorConfiguration getConfiguration ( String type ) { return loadConfig ( PropertyUtil . getProperty ( HAWKULAR_APM_CONFIG , DEFAULT_URI ) , type ) ; }
This method returns the collector configuration .
133,112
protected static CollectorConfiguration loadConfig ( String uri , String type ) { final CollectorConfiguration config = new CollectorConfiguration ( ) ; if ( type == null ) { type = DEFAULT_TYPE ; } uri += java . io . File . separator + type ; File f = new File ( uri ) ; if ( ! f . isAbsolute ( ) ) { if ( f . exists ( ...
This method loads the configuration from the supplied URI .
133,113
protected void process ( String tenantId , List < S > items , int retryCount ) throws Exception { ProcessingUnit < S , T > pu = new ProcessingUnit < S , T > ( ) ; pu . setProcessor ( getProcessor ( ) ) ; pu . setRetrySubscriber ( retrySubscriber ) ; pu . setRetryCount ( retryCount ) ; pu . setResultHandler ( ( tid , ev...
This method processes the received list of items .
133,114
public static List < SourceInfo > getSourceInfo ( String tenantId , List < Trace > items ) throws RetryAttemptException { List < SourceInfo > sourceInfoList = new ArrayList < SourceInfo > ( ) ; int curpos = 0 ; for ( int i = 0 ; i < items . size ( ) ; i ++ ) { Trace trace = items . get ( i ) ; StringBuffer nodeId = new...
This method gets the source information associated with the supplied traces .
133,115
protected static void initialiseSourceInfo ( List < SourceInfo > sourceInfoList , String tenantId , Trace trace , StringBuffer parentNodeId , int pos , Node node ) { SourceInfo si = new SourceInfo ( ) ; parentNodeId . append ( ':' ) ; parentNodeId . append ( pos ) ; si . setId ( parentNodeId . toString ( ) ) ; si . set...
This method initialises an individual node within a trace .
133,116
protected static Span findRootOrServerSpan ( String tenantId , Span span , SpanCache spanCache ) { while ( span != null && ! span . serverSpan ( ) && ! span . topLevelSpan ( ) ) { span = spanCache . get ( tenantId , span . getParentId ( ) ) ; } return span ; }
This method identifies the root or enclosing server span that contains the supplied client span .
133,117
public static SourceInfo getSourceInfo ( String tenantId , Span serverSpan , SpanCache spanCache ) { String clientSpanId = SpanUniqueIdGenerator . getClientId ( serverSpan . getId ( ) ) ; if ( spanCache != null && clientSpanId != null ) { Span clientSpan = spanCache . get ( tenantId , clientSpanId ) ; Span rootOrServer...
This method attempts to derive the Source Information for the supplied server span . If the information is not available then a null will be returned which can be used to trigger a retry attempt if appropriate .
133,118
public static ProcessorActionHandler getHandler ( ProcessorAction action ) { ProcessorActionHandler ret = null ; Class < ? extends ProcessorActionHandler > cls = handlers . get ( action . getClass ( ) ) ; if ( cls != null ) { try { Constructor < ? extends ProcessorActionHandler > con = cls . getConstructor ( ProcessorA...
This method returns an action handler for the supplied action .
133,119
protected static boolean processConfig ( ) { CollectorConfiguration config = configService . getCollector ( null , null , null , null ) ; if ( config != null ) { try { updateInstrumentation ( config ) ; } catch ( Exception e ) { log . severe ( "Failed to update instrumentation rules: " + e ) ; } } return config != null...
This method attempts to retrieve and process the instrumentation information contained within the collector configuration .
133,120
public static void updateInstrumentation ( CollectorConfiguration config ) throws Exception { List < String > scripts = new ArrayList < String > ( ) ; List < String > scriptNames = new ArrayList < String > ( ) ; Map < String , Instrumentation > instrumentTypes = config . getInstrumentation ( ) ; for ( Map . Entry < Str...
This method updates the instrumentation instructions .
133,121
public Node build ( ) { ContainerNode ret = null ; if ( nodeType == NodeType . Component ) { ret = new Component ( ) ; ( ( Component ) ret ) . setComponentType ( componentType ) ; } else if ( nodeType == NodeType . Consumer ) { ret = new Consumer ( ) ; ( ( Consumer ) ret ) . setEndpointType ( endpointType ) ; } else if...
This method builds the node hierarchy .
133,122
public void endProcessingNode ( ) { if ( nodeCount . decrementAndGet ( ) == 0 && recorder != null ) { Node node = rootNode . build ( ) ; trace . setTimestamp ( node . getTimestamp ( ) ) ; trace . setTransaction ( getTransaction ( ) ) ; trace . getNodes ( ) . add ( node ) ; if ( checkForSamplingProperties ( node ) ) { r...
This method indicates the end of processing a node within the trace instance . Once all nodes for a trace have completed being processed the trace will be reported .
133,123
public EndpointRef getSourceEndpoint ( ) { return new EndpointRef ( TagUtil . getUriPath ( topSpan . getTags ( ) ) , topSpan . getOperationName ( ) , false ) ; }
This method returns the source endpoint for the root trace fragment generated by the service invocation .
133,124
public void initTraceState ( Map < String , Object > state ) { Object traceId = state . get ( Constants . HAWKULAR_APM_TRACEID ) ; Object transaction = state . get ( Constants . HAWKULAR_APM_TXN ) ; Object level = state . get ( Constants . HAWKULAR_APM_LEVEL ) ; if ( traceId != null ) { setTraceId ( traceId . toString ...
Initialise the trace state from the supplied state .
133,125
private static boolean checkForSamplingProperties ( Node node ) { Set < Property > samplingProperties = node instanceof ContainerNode ? ( ( ContainerNode ) node ) . getPropertiesIncludingDescendants ( Tags . SAMPLING_PRIORITY . getKey ( ) ) : node . getProperties ( Tags . SAMPLING_PRIORITY . getKey ( ) ) ; for ( Proper...
This method is looking for sampling tag in nodes properties to override current sampling .
133,126
public static String encodeEndpoint ( String uri , String operation ) { StringBuilder buf = new StringBuilder ( ) ; if ( uri != null && ! uri . trim ( ) . isEmpty ( ) ) { buf . append ( uri ) ; } if ( operation != null && ! operation . trim ( ) . isEmpty ( ) ) { buf . append ( '[' ) ; buf . append ( operation ) ; buf ....
This method converts the supplied URI and optional operation into an endpoint descriptor .
133,127
public static String decodeEndpointURI ( String endpoint ) { int ind = endpoint . indexOf ( '[' ) ; if ( ind == 0 ) { return null ; } else if ( ind != - 1 ) { return endpoint . substring ( 0 , ind ) ; } return endpoint ; }
This method returns the URI part of the supplied endpoint .
133,128
public static String decodeEndpointOperation ( String endpoint , boolean stripped ) { int ind = endpoint . indexOf ( '[' ) ; if ( ind != - 1 ) { if ( stripped ) { return endpoint . substring ( ind + 1 , endpoint . length ( ) - 1 ) ; } return endpoint . substring ( ind ) ; } return null ; }
This method returns the operation part of the supplied endpoint .
133,129
public static String encodeClientURI ( String uri ) { if ( uri == null ) { return Constants . URI_CLIENT_PREFIX ; } return Constants . URI_CLIENT_PREFIX + uri ; }
This method provides a client based encoding of an URI . This is required to identify the client node invoking a service using a particular URI .
133,130
public static String decodeClientURI ( String clientUri ) { return clientUri . startsWith ( Constants . URI_CLIENT_PREFIX ) ? clientUri . substring ( Constants . URI_CLIENT_PREFIX . length ( ) ) : clientUri ; }
This method provides a decoding of a client based URI .
133,131
public static EndpointRef getSourceEndpoint ( Trace fragment ) { Node rootNode = fragment . getNodes ( ) . isEmpty ( ) ? null : fragment . getNodes ( ) . get ( 0 ) ; if ( rootNode == null ) { return null ; } return new EndpointRef ( rootNode . getUri ( ) , rootNode . getOperation ( ) , fragment . initialFragment ( ) &&...
This method determines the source URI that should be attributed to the supplied fragment . If the top level fragment just contains a Producer then prefix with client to distinguish it from the same endpoint for the service .
133,132
protected void submitTraces ( ) { if ( ! traces . isEmpty ( ) ) { List < Trace > toSend = traces ; traces = new ArrayList < > ( batchSize + 1 ) ; executor . execute ( new Runnable ( ) { public void run ( ) { try { tracePublisher . publish ( tenantId , toSend ) ; } catch ( Exception e ) { log . log ( Level . SEVERE , "F...
This method submits the current list of traces
133,133
public static List < HttpCode > getHttpStatusCodes ( List < BinaryAnnotation > binaryAnnotations ) { if ( binaryAnnotations == null ) { return Collections . emptyList ( ) ; } List < HttpCode > httpCodes = new ArrayList < > ( ) ; for ( BinaryAnnotation binaryAnnotation : binaryAnnotations ) { if ( Constants . ZIPKIN_BIN...
Method returns list of http status codes .
133,134
public static List < HttpCode > getClientOrServerErrors ( List < HttpCode > httpCodes ) { return httpCodes . stream ( ) . filter ( x -> x . isClientOrServerError ( ) ) . collect ( Collectors . toList ( ) ) ; }
Method returns only client or sever http errors .
133,135
public static String getHttpMethod ( Span span ) { if ( isHttp ( span ) ) { BinaryAnnotation ba = span . getBinaryAnnotation ( "http.method" ) ; String httpMethod = null ; if ( ba != null ) { httpMethod = ba . getValue ( ) . toUpperCase ( ) ; } else if ( span . getName ( ) != null ) { httpMethod = span . getName ( ) . ...
Derives HTTP operation from Span s binary annotations .
133,136
private static Integer toInt ( String str ) { Integer num = null ; try { num = Integer . parseInt ( str ) ; } catch ( NumberFormatException ex ) { log . severe ( String . format ( "failed to convert str: %s to integer" , str ) ) ; } return num ; }
Converts string to a number .
133,137
public static String serialize ( Object value ) { if ( value instanceof String ) { return ( String ) value ; } else if ( value instanceof byte [ ] ) { return new String ( ( byte [ ] ) value ) ; } }
This method converts the supplied object to a string .
133,138
public Set < Property > allProperties ( ) { Set < Property > properties = new HashSet < Property > ( ) ; for ( Node n : nodes ) { n . includeProperties ( properties ) ; } return Collections . unmodifiableSet ( properties ) ; }
This method returns all properties contained in the node hierarchy that can be used to search for the trace .
133,139
public long calculateDuration ( ) { if ( ! nodes . isEmpty ( ) ) { long endTime = 0 ; for ( int i = 0 ; i < getNodes ( ) . size ( ) ; i ++ ) { Node node = getNodes ( ) . get ( i ) ; long nodeEndTime = node . overallEndTime ( ) ; if ( nodeEndTime > endTime ) { endTime = nodeEndTime ; } } return endTime - getNodes ( ) . ...
This method returns the duration of the trace fragment .
133,140
public Set < Node > getCorrelatedNodes ( CorrelationIdentifier cid ) { Set < Node > ret = new HashSet < Node > ( ) ; for ( Node n : getNodes ( ) ) { n . findCorrelatedNodes ( cid , ret ) ; } return ret ; }
This method locates any node within the trace that is associated with the supplied correlation id .
133,141
protected void initNode ( ) { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( TransportClient . class . getClassLoader ( ) ) ; final Properties properties = new Properties ( ) ; try { InputStream stream = null ; if ( System . getProper...
This method initializes the node .
133,142
public void close ( ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Close Elasticsearch node=" + node + " client=" + client ) ; } if ( client != null ) { client . close ( ) ; client = null ; } if ( node != null ) { node . stop ( ) ; node = null ; } }
This method closes the elasticsearch node .
133,143
public < T > T cast ( Object obj , Class < T > clz ) { if ( ! clz . isAssignableFrom ( obj . getClass ( ) ) ) { return null ; } return clz . cast ( obj ) ; }
This method casts the supplied object to the nominated class . If the object cannot be cast to the provided type then a null will be returned .
133,144
public String formatSQL ( Object obj , Object expr ) { String sql = null ; if ( expr instanceof String ) { sql = ( String ) expr ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "SQL retrieved from state = " + sql ) ; } } else if ( obj != null ) { sql = toString ( obj ) ; if ( sql != null ) { if ( sql . st...
This method attempts to return a SQL statement . If an expression is supplied and is string it will be used . Otherwise the method will attempt to derive an expression from the supplied object .
133,145
protected FaultDescriptor getFaultDescriptor ( Object fault ) { for ( int i = 0 ; i < faultDescriptors . size ( ) ; i ++ ) { if ( faultDescriptors . get ( i ) . isValid ( fault ) ) { return faultDescriptors . get ( i ) ; } } return null ; }
This method attempts to locate a descriptor for the fault .
133,146
public String faultName ( Object fault ) { FaultDescriptor fd = getFaultDescriptor ( fault ) ; if ( fd != null ) { return fd . getName ( fault ) ; } return fault . getClass ( ) . getSimpleName ( ) ; }
This method gets the name of the supplied fault .
133,147
public String faultDescription ( Object fault ) { FaultDescriptor fd = getFaultDescriptor ( fault ) ; if ( fd != null ) { return fd . getDescription ( fault ) ; } return fault . toString ( ) ; }
This method gets the description of the supplied fault .
133,148
public String removeAfter ( String original , String marker ) { int index = original . indexOf ( marker ) ; if ( index != - 1 ) { return original . substring ( 0 , index ) ; } return original ; }
This method removes the end part of a string beginning at a specified marker .
133,149
public Map < String , String > getHeaders ( String type , Object target ) { HeadersAccessor accessor = getHeadersAccessor ( type ) ; if ( accessor != null ) { Map < String , String > ret = accessor . getHeaders ( target ) ; return ret ; } return null ; }
This method attempts to provide headers for the supplied target object .
133,150
public static BinaryAnnotationMappingDeriver getInstance ( String path ) { if ( instance == null ) { synchronized ( LOCK ) { if ( instance == null ) { instance = path == null ? new BinaryAnnotationMappingDeriver ( ) : new BinaryAnnotationMappingDeriver ( path ) ; } } } return instance ; }
Returns instance of mapping deriver .
133,151
public MappingResult mappingResult ( List < BinaryAnnotation > binaryAnnotations ) { if ( binaryAnnotations == null ) { return new MappingResult ( ) ; } List < String > componentTypes = new ArrayList < > ( ) ; List < String > endpointTypes = new ArrayList < > ( ) ; MappingResult . Builder mappingBuilder = MappingResult...
Creates a mapping result from supplied binary annotations .
133,152
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 ) ; boolean ignoreNode = false ; boolean ignoreChildNodes = false ; if ( n . getClass ( ) =...
This method recursively derives the node details metrics for the supplied nodes .
133,153
protected Set < Property > obtainCommonProperties ( Trace trace ) { Set < Property > commonProperties = trace . getProperties ( Constants . PROP_SERVICE_NAME ) ; commonProperties . addAll ( trace . getProperties ( Constants . PROP_BUILD_STAMP ) ) ; commonProperties . addAll ( trace . getProperties ( Constants . PROP_PR...
Obtain any properties from the trace that should be applied to all derived NodeDetails .
133,154
protected long calculateActualTime ( Node n ) { long childElapsed = 0 ; if ( n . containerNode ( ) ) { long startTime = n . getTimestamp ( ) + n . getDuration ( ) ; long endTime = n . getTimestamp ( ) ; for ( int i = 0 ; i < ( ( ContainerNode ) n ) . getNodes ( ) . size ( ) ; i ++ ) { Node child = ( ( ContainerNode ) n...
This method calculates the actual time associated with the supplied node .
133,155
public boolean process ( Trace trace , Node node , Direction direction , Map < String , ? > headers , Object [ ] values ) { if ( predicate != null ) { return predicate . test ( trace , node , direction , headers , values ) ; } return true ; }
This method processes the supplied information to extract the relevant details .
133,156
public boolean isVersionValid ( String version ) { if ( fromVersion != null && version != null ) { if ( version . compareTo ( fromVersion ) < 0 ) { return false ; } } if ( toVersion != null ) { if ( version == null || version . compareTo ( toVersion ) >= 0 ) { return false ; } } return true ; }
This method determines if the rule is valid for the supplied version . If the supplied version is null then it is assumed to represent latest version and therefore any rule with a toVersion set will not be valid .
133,157
public void finest ( String mesg , Throwable t ) { log ( Level . FINEST , mesg , t ) ; }
This method logs a message at the FINEST level .
133,158
public void finer ( String mesg , Throwable t ) { log ( Level . FINER , mesg , t ) ; }
This method logs a message at the FINER level .
133,159
public void fine ( String mesg , Throwable t ) { log ( Level . FINE , mesg , t ) ; }
This method logs a message at the FINE level .
133,160
public void info ( String mesg , Throwable t ) { log ( Level . INFO , mesg , t ) ; }
This method logs a message at the INFO level .
133,161
public void warning ( String mesg , Throwable t ) { log ( Level . WARNING , mesg , t ) ; }
This method logs a message at the WARNING level .
133,162
public void severe ( String mesg , Throwable t ) { log ( Level . SEVERE , mesg , t ) ; }
This method logs a message at the SEVERE level .
133,163
public void log ( Level mesgLevel , String mesg , Throwable t ) { if ( mesgLevel . ordinal ( ) >= level . ordinal ( ) ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( mesgLevel . name ( ) ) ; builder . append ( ": [" ) ; builder . append ( simpleClassName != null ? simpleClassName : className ) ; ...
This method logs a message at the supplied message level with an optional exception .
133,164
public static String deriveOperation ( Span span ) { if ( SpanHttpDeriverUtil . isHttp ( span ) ) { return SpanHttpDeriverUtil . getHttpMethod ( span ) ; } return span . getName ( ) ; }
Derives an operation from supplied span .
133,165
public boolean isCompleteExceptIgnoredNodes ( ) { synchronized ( nodeStack ) { if ( nodeStack . isEmpty ( ) && retainedNodes . isEmpty ( ) ) { return true ; } else { for ( int i = 0 ; i < nodeStack . size ( ) ; i ++ ) { if ( ! ignoredNodes . contains ( nodeStack . get ( i ) ) ) { return false ; } } for ( int i = 0 ; i ...
This method determines if the fragment is complete with the exception of ignored nodes .
133,166
public void pushNode ( Node node ) { initNode ( node ) ; inStream = null ; synchronized ( nodeStack ) { poppedNodes . clear ( ) ; if ( suppress ) { suppressedNodeStack . push ( node ) ; return ; } if ( nodeStack . isEmpty ( ) ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Pushing top level node: " + n...
This method pushes a new node into the trace fragment hierarchy .
133,167
public Node popNode ( Class < ? extends Node > cls , String uri ) { synchronized ( nodeStack ) { if ( suppress ) { if ( ! suppressedNodeStack . isEmpty ( ) ) { Node suppressed = popNode ( suppressedNodeStack , cls , uri ) ; if ( suppressed != null ) { return suppressed ; } } else { suppress = false ; } } return popNode...
This method pops the latest node from the trace fragment hierarchy .
133,168
protected Node popNode ( Stack < Node > stack , Class < ? extends Node > cls , String uri ) { Node top = stack . isEmpty ( ) ? null : stack . peek ( ) ; if ( top != null ) { if ( nodeMatches ( top , cls , uri ) ) { Node node = stack . pop ( ) ; poppedNodes . push ( node ) ; return node ; } else { for ( int i = stack . ...
This method pops a node of the defined class and optional uri from the stack . If the uri is not defined then the latest node of the approach class will be chosen .
133,169
protected boolean nodeMatches ( Node node , Class < ? extends Node > cls , String uri ) { if ( node . getClass ( ) == cls ) { return uri == null || NodeUtil . isOriginalURI ( node , uri ) ; } return false ; }
This method determines whether the supplied node matches the specified class and optional URI .
133,170
public void retainNode ( String id ) { synchronized ( retainedNodes ) { Node current = getCurrentNode ( ) ; if ( current != null ) { retainedNodes . put ( id , current ) ; } } }
This method indicates that the current node for this thread of execution should be retained temporarily pending further changes .
133,171
public void addUncompletedCorrelationId ( String id , Node node , int position ) { NodePlaceholder placeholder = new NodePlaceholder ( ) ; placeholder . setNode ( node ) ; placeholder . setPosition ( position ) ; uncompletedCorrelationIdsNodeMap . put ( id , placeholder ) ; }
This method associates a parent node and child position with a correlation id .
133,172
public int getUncompletedCorrelationIdPosition ( String id ) { if ( uncompletedCorrelationIdsNodeMap . containsKey ( id ) ) { return uncompletedCorrelationIdsNodeMap . get ( id ) . getPosition ( ) ; } return - 1 ; }
This method returns the child position associated with the supplied correlation id .
133,173
public Node removeUncompletedCorrelationId ( String id ) { NodePlaceholder placeholder = uncompletedCorrelationIdsNodeMap . remove ( id ) ; if ( placeholder != null ) { return placeholder . getNode ( ) ; } return null ; }
This method removes the uncompleted correlation id and its associated information .
133,174
public void writeInData ( int hashCode , byte [ ] b , int offset , int len ) { if ( inStream != null && ( hashCode == - 1 || hashCode == inHashCode ) ) { inStream . write ( b , offset , len ) ; } }
This method writes data to the in buffer .
133,175
public byte [ ] getInData ( int hashCode ) { if ( inStream != null && ( hashCode == - 1 || hashCode == inHashCode ) ) { try { inStream . close ( ) ; } catch ( IOException e ) { log . severe ( "Failed to close in data stream: " + e ) ; } byte [ ] b = inStream . toByteArray ( ) ; inStream = null ; return b ; } return nul...
This method returns the data associated with the in buffer and resets the buffer to be inactive .
133,176
public void writeOutData ( int hashCode , byte [ ] b , int offset , int len ) { if ( outStream != null && ( hashCode == - 1 || hashCode == outHashCode ) ) { outStream . write ( b , offset , len ) ; } }
This method writes data to the out buffer .
133,177
public byte [ ] getOutData ( int hashCode ) { if ( outStream != null && ( hashCode == - 1 || hashCode == outHashCode ) ) { try { outStream . close ( ) ; } catch ( IOException e ) { log . severe ( "Failed to close out data stream: " + e ) ; } byte [ ] b = outStream . toByteArray ( ) ; outStream = null ; return b ; } ret...
This method returns the data associated with the out buffer and resets the buffer to be inactive .
133,178
public void setState ( Object context , String name , Object value ) { StateInformation si = stateInformation . get ( name ) ; if ( si == null ) { si = new StateInformation ( ) ; stateInformation . put ( name , si ) ; } si . set ( context , value ) ; }
This method stores state information associated with the name and optional context .
133,179
public Object getState ( Object context , String name ) { StateInformation si = stateInformation . get ( name ) ; if ( si == null ) { return null ; } return si . get ( context ) ; }
This method returns the state associated with the name and optional context .
133,180
public static String getUriPath ( String value ) { try { URL url = new URL ( value ) ; return url . getPath ( ) ; } catch ( MalformedURLException e ) { return value ; } }
This method extracts the path component of a URL . If the supplied value is not a valid URL format then it will simply return the supplied value .
133,181
public static String getUriPath ( Map < String , Object > tags ) { for ( Map . Entry < String , Object > entry : tags . entrySet ( ) ) { if ( isUriKey ( entry . getKey ( ) ) ) { return getUriPath ( entry . getValue ( ) . toString ( ) ) ; } } return null ; }
This method returns the URI value from a set of supplied tags by first identifying which tag relates to a URI and then returning its path value .
133,182
public static void rewriteURI ( Node node , String uri ) { node . getProperties ( ) . add ( new Property ( APM_ORIGINAL_URI , node . getUri ( ) ) ) ; node . setUri ( uri ) ; }
This method rewrites the URI associated with the supplied node and stores the original in the node s details .
133,183
public static boolean isOriginalURI ( Node node , String uri ) { if ( node . getUri ( ) . equals ( uri ) ) { return true ; } if ( node . hasProperty ( APM_ORIGINAL_URI ) ) { return node . getProperties ( APM_ORIGINAL_URI ) . iterator ( ) . next ( ) . getValue ( ) . equals ( uri ) ; } return false ; }
This method determines whether the supplied URI matches the original URI on the node .
133,184
protected Object getDataValue ( Trace trace , Node node , Direction direction , Map < String , ? > headers , Object [ ] values ) { if ( source == DataSource . Content ) { return values [ index ] ; } else if ( source == DataSource . Header ) { return headers . get ( key ) ; } return null ; }
This method returns the data value associated with the requested data source and key ..
133,185
protected void includeProperties ( Set < Property > allProperties ) { super . includeProperties ( allProperties ) ; nodes . forEach ( n -> n . includeProperties ( allProperties ) ) ; }
This method adds the properties for this node to the supplied set .
133,186
protected long overallEndTime ( ) { long ret = super . overallEndTime ( ) ; for ( Node child : nodes ) { long childEndTime = child . overallEndTime ( ) ; if ( childEndTime > ret ) { ret = childEndTime ; } } return ret ; }
This method determines the overall end time of this node .
133,187
protected Collection < CommunicationSummaryStatistics > doGetCommunicationSummaryStatistics ( String tenantId , Criteria criteria ) { String index = client . getIndex ( tenantId ) ; Map < String , CommunicationSummaryStatistics > stats = new HashMap < > ( ) ; if ( ! criteria . transactionWide ( ) ) { Criteria txnWideCr...
This method returns the flat list of communication summary stats .
133,188
private void buildCommunicationSummaryStatistics ( Map < String , CommunicationSummaryStatistics > stats , String index , Criteria criteria , boolean addMetrics ) { if ( ! refresh ( index ) ) { return ; } BoolQueryBuilder query = buildQuery ( criteria , ElasticsearchUtil . TRANSACTION_FIELD , null ) ; query = query . m...
This method builds a map of communication summary stats related to the supplied criteria .
133,189
static String getServiceFromBuildName ( String buildName ) { if ( null == buildName || buildName . isEmpty ( ) ) { return buildName ; } return buildName . substring ( 0 , buildName . lastIndexOf ( '-' ) ) ; }
Converts an OpenShift build name into a service name
133,190
public static void executeDatabaseScript ( String script ) throws SQLException , MalformedURLException { File file = new File ( script ) ; DatabaseUtils . executeSqlScript ( DatabaseUtils . getDBConnection ( null ) , file . toURI ( ) . toURL ( ) ) ; }
Executes database script from resources directory
133,191
private static void executeSqlScript ( Connection connection , URL scriptUrl ) throws SQLException { for ( String sqlStatement : readSqlStatements ( scriptUrl ) ) { if ( ! sqlStatement . trim ( ) . isEmpty ( ) ) { connection . prepareStatement ( sqlStatement ) . executeUpdate ( ) ; } } }
Executes SQL script .
133,192
private static String [ ] readSqlStatements ( URL url ) { try { char buffer [ ] = new char [ 256 ] ; StringBuilder result = new StringBuilder ( ) ; InputStreamReader reader = new InputStreamReader ( url . openStream ( ) , "UTF-8" ) ; while ( true ) { int count = reader . read ( buffer ) ; if ( count < 0 ) { break ; } r...
Reads SQL statements from file . SQL commands in file must be separated by a semicolon .
133,193
public void call ( Message mesg , String interactionId , String btxnName ) { boolean activated = collector . session ( ) . activate ( uri , null , interactionId ) ; if ( activated ) { collector . consumerStart ( null , uri , "Test" , null , interactionId ) ; collector . setTransaction ( null , btxnName ) ; } if ( calle...
This method simulates calling the service .
133,194
public Node addInteractionCorrelationId ( String id ) { this . correlationIds . add ( new CorrelationIdentifier ( Scope . Interaction , id ) ) ; return this ; }
This method adds an interaction scoped correlation id .
133,195
public Node addControlFlowCorrelationId ( String id ) { this . correlationIds . add ( new CorrelationIdentifier ( Scope . ControlFlow , id ) ) ; return this ; }
This method adds a control flow scoped correlation id .
133,196
public Node addCausedByCorrelationId ( String id ) { this . correlationIds . add ( new CorrelationIdentifier ( Scope . CausedBy , id ) ) ; return this ; }
This method adds a caused by scoped correlation id .
133,197
protected void findCorrelatedNodes ( CorrelationIdentifier cid , Set < Node > nodes ) { if ( isCorrelated ( cid ) ) { nodes . add ( this ) ; } }
This method identifies all of the nodes within a trace that are associated with the supplied correlation identifier .
133,198
protected boolean isCorrelated ( CorrelationIdentifier cid ) { for ( CorrelationIdentifier id : correlationIds ) { if ( id . equals ( cid ) ) { return true ; } } return false ; }
This method determines whether the node is correlated to the supplied identifier .
133,199
protected static List < EndpointInfo > compressEndpointInfo ( List < EndpointInfo > endpoints ) { List < EndpointInfo > others = new ArrayList < EndpointInfo > ( ) ; EndpointPart rootPart = new EndpointPart ( ) ; for ( int i = 0 ; i < endpoints . size ( ) ; i ++ ) { EndpointInfo endpoint = endpoints . get ( i ) ; if ( ...
This method compresses the list of endpoints to identify common patterns .