deep.processor.trigger_handler
Handle events from the python engine to trigger tracepoints.
Using the sys.settrace
and threading.settrace
functions we register a function to
process events from the python engine. When we get an event we are interested in (e.g. line) we can match that
to a tracepoint config and if we have a match process the frame data to collect a snapshot, add logs or any
other supported action.
TracepointHandlerUpdateListener
Bases: ConfigUpdateListener
This is the listener that connects the config to the handler.
Source code in deep/processor/trigger_handler.py
__init__(handler)
Create a new update listener.
:param handler: the handler to call when a new tracepoint config is ready
config_change(ts, old_hash, current_hash, old_config, new_config)
Process an update to the tracepoint config.
:param ts: the ts of the new config :param old_hash: the old config hash :param current_hash: the new config hash :param old_config: the old config :param new_config: the new config
Source code in deep/processor/trigger_handler.py
TriggerHandler
This is the handler for the tracepoints.
This is where we 'listen' for a hit, and determine if we should collect data.
Source code in deep/processor/trigger_handler.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
__init__(config, push_service)
Create a new tigger handler.
:param config: the config service :param push_service: the push service
Source code in deep/processor/trigger_handler.py
location_from_event(event, frame)
staticmethod
Convert an event into a location.
The events are as follows
- line: a line is being executed
- call: a function is being called
- return: a function is being returned
- exception: an exception is being raised
:param event: :param frame: :returns: - event - file path - line number - function name
Source code in deep/processor/trigger_handler.py
new_config(new_config)
Process a new tracepoint config.
Called when a change to the tracepoint config is processed.
:param new_config: the new config to use
Source code in deep/processor/trigger_handler.py
shutdown()
Shutdown this handler.
Reset the settrace to the previous values.
start()
Start the trigger handler.
Source code in deep/processor/trigger_handler.py
trace_call(frame, event, arg)
Process the data for a trace call.
This is called by the python engine when an event is about to be called.
This is called by python with the current frame data The events are as follows: - line: a line is being executed - call: a function is being called - return: a function is being returned - exception: an exception is being raised
:param frame: the current frame :param event: the event 'line', 'call', etc. That we are processing. :param arg: the args :return: None to ignore other calls, or our self to continue