Class FrameCollector
- java.lang.Object
-
- com.intergral.deep.agent.tracepoint.handler.VariableProcessor
-
- com.intergral.deep.agent.tracepoint.handler.FrameCollector
-
- Direct Known Subclasses:
FrameProcessor
public class FrameCollector extends VariableProcessor
This type allows the collection of frame data, ie stack frames, watchers and other tracepoint data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
FrameCollector.IExpressionResult
The result of evaluating an expression.protected static interface
FrameCollector.IFrameResult
The result of processing the frames.protected static interface
FrameCollector.ILogProcessResult
The result of processing the tracepoint log message.-
Nested classes/interfaces inherited from class com.intergral.deep.agent.tracepoint.handler.VariableProcessor
VariableProcessor.VariableResponse
-
-
Field Summary
Fields Modifier and Type Field Description protected IEvaluator
evaluator
The evaluator that should be used by this callback.protected Settings
settings
The current settings use my deep.protected Map<String,Object>
variables
The variables that have been captured by the callback.-
Fields inherited from class com.intergral.deep.agent.tracepoint.handler.VariableProcessor
frameConfig
-
-
Constructor Summary
Constructors Constructor Description FrameCollector(Settings settings, IEvaluator evaluator, Map<String,Object> variables, StackTraceElement[] stack, String methodName)
Create a frame collector to collect the frame data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FrameCollector.IExpressionResult
evaluateWatchExpression(String watch, String source)
Evaluate a watch expression into aFrameCollector.IExpressionResult
.protected String
getMethodName(StackTraceElement stackTraceElement, Map<String,Object> variables, int frameIndex)
Get the method name from the stack frame.protected boolean
isAppFrame(StackTraceElement stackTraceElement)
An app frame is defined via the settingsISettings.APP_FRAMES_INCLUDES
andISettings.APP_FRAMES_EXCLUDES
.protected void
logTracepoint(String logMsg, String tracepointId, String snapshotId)
protected Resource
processAttributes(TracePointConfig tracepoint)
Using the current tracepoint config, create aResource
the can be used as the attributes.protected FrameCollector.IFrameResult
processFrame()
Processes and collects all the data for the captured frame.protected FrameCollector.ILogProcessResult
processLogMsg(TracePointConfig tracepoint, String logMsg)
protected boolean
processNode(Node node)
This is where we take a node from BFS queue and process it back onto the queue.protected List<VariableID>
processVars(Map<String,Object> variables)
This is where we start the Breadth first search (BFS) of the selected variables.protected Map<String,Object>
selectVariables(int frameIndex)
Select from the available captured variables the variables we want to process for this frame.-
Methods inherited from class com.intergral.deep.agent.tracepoint.handler.VariableProcessor
appendChild, appendVariable, checkDepth, checkId, checkVarCount, closeLookup, configureSelf, newVarId, processChildNodes, processVariable
-
-
-
-
Field Detail
-
settings
protected final Settings settings
The current settings use my deep.
-
evaluator
protected final IEvaluator evaluator
The evaluator that should be used by this callback.
-
-
Constructor Detail
-
FrameCollector
public FrameCollector(Settings settings, IEvaluator evaluator, Map<String,Object> variables, StackTraceElement[] stack, String methodName)
Create a frame collector to collect the frame data.- Parameters:
settings
- the current settings being used by deepevaluator
- the evaluator to use for this callbackvariables
- the variables captured by the callbackstack
- the stack captured by the callbackmethodName
- the name of the method we are wrapping, ornull
if not a method wrapped collection
-
-
Method Detail
-
processFrame
protected FrameCollector.IFrameResult processFrame()
Processes and collects all the data for the captured frame.- Returns:
- the result of the process
FrameCollector.IFrameResult
-
selectVariables
protected Map<String,Object> selectVariables(int frameIndex)
Select from the available captured variables the variables we want to process for this frame. This is mainly here to allow for an easy way for CF to map the variables from their capture Java types to the expected CF types.- Parameters:
frameIndex
- the index of the frame we are processing- Returns:
- the variables available at this frame
-
processVars
protected List<VariableID> processVars(Map<String,Object> variables)
This is where we start the Breadth first search (BFS) of the selected variables.Here we are essentially dealing with the BFS nodes and linking to the VariableProcessor to do the processing.
- Parameters:
variables
- the variables to process- Returns:
- the variable ref used in the snapshot
- See Also:
VariableProcessor
-
processNode
protected boolean processNode(Node node)
This is where we take a node from BFS queue and process it back onto the queue.Essentially, we take a node, we process this node, the add the child nodes back onto the BFS queue.
- Parameters:
node
- the node to process- Returns:
true
if we should continue to process more nodes, elsefalse
.
-
isAppFrame
protected boolean isAppFrame(StackTraceElement stackTraceElement)
An app frame is defined via the settingsISettings.APP_FRAMES_INCLUDES
andISettings.APP_FRAMES_EXCLUDES
. This gives a way to tell deep that the frame is part of your app and not part of the framework. This is primarily used as a way to filter frames in the UI.- Parameters:
stackTraceElement
- the stack frame to process- Returns:
true
if the class name is in the included packages, and not in the excluded packages, elsefalse
.
-
getMethodName
protected String getMethodName(StackTraceElement stackTraceElement, Map<String,Object> variables, int frameIndex)
Get the method name from the stack frame.- Parameters:
stackTraceElement
- the stack frame to processvariables
- the variables for the frameframeIndex
- the frame index- Returns:
- the name of the method
-
evaluateWatchExpression
protected FrameCollector.IExpressionResult evaluateWatchExpression(String watch, String source)
Evaluate a watch expression into aFrameCollector.IExpressionResult
.We always need a result from a watch expression, however, it is possible to have bad watches that error. In some cases it is possible to not have a valid evaluator.
So if we cannot get a result from the
IEvaluator
then we return an error result.- Parameters:
watch
- the watch expression to evaluatesource
- the source of the watch expression- Returns:
- a
FrameCollector.IExpressionResult
- See Also:
WatchResult.LOG
,WatchResult.METRIC
,WatchResult.WATCH
-
processAttributes
protected Resource processAttributes(TracePointConfig tracepoint)
Using the current tracepoint config, create aResource
the can be used as the attributes.The basic attributes created are:
- tracepoint - the id of the tracepoint
- path - the path of the tracepoint
- line - the line of the tracepoint
- stack - the stack type of the tracepoint
- frame - the frame type of the tracepoint
- has_watchers - boolean indicating there are watchers
- has_condition - boolean indicating there is a condition
- Parameters:
tracepoint
- the current config- Returns:
- the new
Resource
-
processLogMsg
protected FrameCollector.ILogProcessResult processLogMsg(TracePointConfig tracepoint, String logMsg)
-
-