whatap-python 1.7.2__tar.gz → 1.7.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of whatap-python might be problematic. Click here for more details.
- {whatap_python-1.7.2 → whatap_python-1.7.4}/PKG-INFO +1 -1
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/agent/darwin/amd64/whatap_python +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/agent/darwin/arm64/whatap_python +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/agent/linux/amd64/whatap_python +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/agent/linux/arm64/whatap_python +0 -0
- whatap_python-1.7.4/whatap/build.py +4 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/packet_enum.py +1 -1
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/amqp_pika.py +21 -12
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_fastapi.py +8 -8
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_wsgi.py +2 -3
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_mongo.py +1 -1
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_redis.py +38 -19
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_toolkit.py +1 -1
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/PKG-INFO +1 -1
- whatap_python-1.7.2/whatap/build.py +0 -4
- {whatap_python-1.7.2 → whatap_python-1.7.4}/README.md +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/setup.cfg +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/setup.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/LICENSE +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/README.rst +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/__main__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/bootstrap/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/bootstrap/sitecustomize.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/conf/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/conf/configuration.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/conf/configure.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/conf/license.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/control/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/counter/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/counter/counter_manager.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/counter/tasks/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/counter/tasks/openfiledescriptor.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/io/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/io/data_inputx.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/io/data_outputx.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/async_sender.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/packet_type_enum.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/param_def.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/stackhelper.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/udp_session.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/net/udp_thread.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/pack/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/pack/logSinkPack.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/pack/pack.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/pack/pack_enum.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/pack/tagCountPack.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/scripts/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/amqp_kombu.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_bottle.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_celery.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_cherrypy.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_django.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_django_asgi.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_django_py3.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_flask.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_frappe.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_graphql.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_nameko.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/application_tornado.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_cxoracle.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_mysql.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/database_postgresql.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/email_smtp.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/httpc_django.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/httpc_httplib.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/httpc_requests.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/httpc_urllib3.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/logging.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/mod/plugin.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/simple_trace_context.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/trace_context.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/trace_context_manager.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/trace_import.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/trace/trace_module_definition.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/bit_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/cardinality/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/cardinality/hyperloglog.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/cardinality/murmurhash.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/cardinality/registerset.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/compare_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/date_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/debug_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/escape_literal_sql.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/hash_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/hexa32.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/int_set.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/ip_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/keygen.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/linked_list.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/linked_map.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/metering_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/request_double_queue.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/request_queue.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/string_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/throttle_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/util/userid_util.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/__init__.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/blob_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/boolean_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/decimal_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/double_summary.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/double_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/float_array.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/float_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/int_array.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/ip4_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/list_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/long_array.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/long_summary.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/map_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/null_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/number_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/summary_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/text_array.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/text_hash_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/text_value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/value.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/value/value_enum.py +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap/whatap.conf +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/SOURCES.txt +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/dependency_links.txt +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/entry_points.txt +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/not-zip-safe +0 -0
- {whatap_python-1.7.2 → whatap_python-1.7.4}/whatap_python.egg-info/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,8 +7,8 @@ import whatap.net.async_sender as async_sender
|
|
|
7
7
|
from whatap.net.packet_type_enum import PacketTypeEnum
|
|
8
8
|
from whatap.util.date_util import DateUtil
|
|
9
9
|
|
|
10
|
-
def parseConnection(conn):
|
|
11
10
|
|
|
11
|
+
def parseConnection(conn):
|
|
12
12
|
connstr = ''
|
|
13
13
|
if conn.host:
|
|
14
14
|
connstr += conn.host
|
|
@@ -16,6 +16,7 @@ def parseConnection(conn):
|
|
|
16
16
|
connstr += "/" + conn.virtual_host
|
|
17
17
|
return connstr
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
def intercept_publish(fn, *args, **kwargs):
|
|
20
21
|
ctx = TraceContextManager.getLocalContext()
|
|
21
22
|
|
|
@@ -30,22 +31,30 @@ def intercept_publish(fn, *args, **kwargs):
|
|
|
30
31
|
ctx.active_dbc = text
|
|
31
32
|
ctx.lctx['dbc'] = text
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
try:
|
|
35
|
+
result = fn(*args, **kwargs)
|
|
36
|
+
|
|
37
|
+
ctx.active_dbc = 0
|
|
38
|
+
ctx.db_opening = True
|
|
39
|
+
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
40
|
+
datas = [' ', ' ', 'MQ SESSION INFO: ' + text]
|
|
41
|
+
async_sender.send_packet(PacketTypeEnum.TX_MSG, ctx, datas)
|
|
42
|
+
|
|
43
|
+
return result
|
|
44
|
+
except Exception as e:
|
|
45
|
+
ctx.active_dbc = 0
|
|
46
|
+
ctx.db_opening = False
|
|
47
|
+
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
48
|
+
raise e
|
|
49
|
+
|
|
38
50
|
|
|
39
51
|
def instrument_pika(module):
|
|
40
52
|
def wrapper(fn):
|
|
41
53
|
@trace_handler(fn)
|
|
42
54
|
def trace(*args, **kwargs):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
return intercept_publish(fn, *args, **kwargs)
|
|
56
|
+
|
|
46
57
|
return trace
|
|
47
58
|
|
|
48
59
|
if hasattr(module, 'Channel') and hasattr(module.Channel, 'basic_publish'):
|
|
49
|
-
module.Channel.basic_publish = wrapper(module.Channel.basic_publish)
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
module.Channel.basic_publish = wrapper(module.Channel.basic_publish)
|
|
@@ -171,23 +171,23 @@ def interceptor(fn, dependant, *args, **kwargs):
|
|
|
171
171
|
ctx.userid, ctx._rawuserid = getUserId(environ, ctx.remoteIp)
|
|
172
172
|
|
|
173
173
|
mstt = environ.get('{}'.format(
|
|
174
|
-
conf._trace_mtrace_caller_key
|
|
174
|
+
conf._trace_mtrace_caller_key), '')
|
|
175
175
|
|
|
176
176
|
if mstt:
|
|
177
177
|
ctx.setTransfer(mstt)
|
|
178
178
|
if conf.stat_mtrace_enabled:
|
|
179
179
|
val = environ.get('{}'.format(
|
|
180
|
-
conf._trace_mtrace_info_key
|
|
180
|
+
conf._trace_mtrace_info_key), '')
|
|
181
181
|
if val and len(val):
|
|
182
182
|
ctx.setTransferInfo(val)
|
|
183
183
|
pass
|
|
184
184
|
|
|
185
185
|
myid = environ.get('{}'.format(
|
|
186
|
-
conf._trace_mtrace_callee_key
|
|
186
|
+
conf._trace_mtrace_callee_key), '')
|
|
187
187
|
if myid:
|
|
188
188
|
ctx.setTxid(myid)
|
|
189
189
|
caller_poid = environ.get('{}'.format(
|
|
190
|
-
conf._trace_mtrace_caller_poid_key
|
|
190
|
+
conf._trace_mtrace_caller_poid_key), '')
|
|
191
191
|
|
|
192
192
|
if caller_poid:
|
|
193
193
|
ctx.mcaller_poid = caller_poid
|
|
@@ -261,23 +261,23 @@ async def interceptor_async(fn, dependant, *args, **kwargs):
|
|
|
261
261
|
ctx.userid, ctx._rawuserid = getUserId(environ, ctx.remoteIp)
|
|
262
262
|
|
|
263
263
|
mstt = environ.get('{}'.format(
|
|
264
|
-
conf._trace_mtrace_caller_key
|
|
264
|
+
conf._trace_mtrace_caller_key), '')
|
|
265
265
|
|
|
266
266
|
if mstt:
|
|
267
267
|
ctx.setTransfer(mstt)
|
|
268
268
|
if conf.stat_mtrace_enabled:
|
|
269
269
|
val = environ.get('{}'.format(
|
|
270
|
-
conf._trace_mtrace_info_key
|
|
270
|
+
conf._trace_mtrace_info_key), '')
|
|
271
271
|
if val and len(val):
|
|
272
272
|
ctx.setTransferInfo(val)
|
|
273
273
|
pass
|
|
274
274
|
|
|
275
275
|
myid = environ.get('{}'.format(
|
|
276
|
-
conf._trace_mtrace_callee_key
|
|
276
|
+
conf._trace_mtrace_callee_key), '')
|
|
277
277
|
if myid:
|
|
278
278
|
ctx.setTxid(myid)
|
|
279
279
|
caller_poid = environ.get('{}'.format(
|
|
280
|
-
conf._trace_mtrace_caller_poid_key
|
|
280
|
+
conf._trace_mtrace_caller_poid_key), '')
|
|
281
281
|
|
|
282
282
|
if caller_poid:
|
|
283
283
|
ctx.mcaller_poid = caller_poid
|
|
@@ -459,10 +459,9 @@ def interceptor_db_execute(fn, *args, **kwargs):
|
|
|
459
459
|
except Exception as e:
|
|
460
460
|
interceptor_step_error(e)
|
|
461
461
|
finally:
|
|
462
|
-
datas = [ctx.lctx.get('dbc', ''), query]
|
|
462
|
+
datas = [ctx.lctx.get('dbc', ''), query, str(self.rowcount)]
|
|
463
463
|
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
464
|
-
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx,
|
|
465
|
-
datas)
|
|
464
|
+
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx, datas)
|
|
466
465
|
count = self.rowcount
|
|
467
466
|
if count > -1:
|
|
468
467
|
desc = '{0}: {1}'.format('Fetch count', count)
|
|
@@ -70,7 +70,7 @@ class WhatapMongoCmdEventListener(pymongo.monitoring.CommandListener):
|
|
|
70
70
|
query +=' query: {}'.format(ctx.active_sqlhash)
|
|
71
71
|
|
|
72
72
|
ctx.db_opening = False
|
|
73
|
-
datas = [ctx.lctx.get('dbc', ''), query]
|
|
73
|
+
datas = [ctx.lctx.get('dbc', ''), query, 0]
|
|
74
74
|
ctx.elapsed = int(event.duration_micros / 1000)
|
|
75
75
|
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx,
|
|
76
76
|
datas)
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
from whatap.trace import get_dict
|
|
2
|
-
from whatap.trace.mod.application_wsgi import trace_handler,
|
|
3
|
-
interceptor_step_error
|
|
2
|
+
from whatap.trace.mod.application_wsgi import trace_handler, interceptor_step_error
|
|
4
3
|
from whatap.trace.trace_context_manager import TraceContextManager
|
|
5
4
|
import whatap.net.async_sender as async_sender
|
|
6
5
|
from whatap.net.packet_type_enum import PacketTypeEnum
|
|
7
6
|
from whatap.util.date_util import DateUtil
|
|
8
7
|
import numbers
|
|
9
8
|
|
|
9
|
+
_current_command = None
|
|
10
|
+
|
|
11
|
+
|
|
10
12
|
def intercept_send_command(fn, instance, *args, **kwargs):
|
|
13
|
+
global _current_command
|
|
14
|
+
command = str(args[0]).upper() if args else None
|
|
15
|
+
_current_command = command
|
|
16
|
+
|
|
17
|
+
if command not in {'SET', 'GET', 'DEL', 'HSET', 'HGET'}:
|
|
18
|
+
return fn(instance, *args, **kwargs)
|
|
19
|
+
|
|
11
20
|
ctx = TraceContextManager.getLocalContext()
|
|
12
21
|
if not ctx:
|
|
13
|
-
|
|
14
22
|
return fn(instance, *args, **kwargs)
|
|
23
|
+
|
|
15
24
|
start_time = DateUtil.nowSystem()
|
|
16
25
|
ctx.start_time = start_time
|
|
17
26
|
|
|
18
27
|
port_or_path = getattr(instance, 'port', getattr(instance, 'path', None))
|
|
19
28
|
text = 'redis://'
|
|
20
|
-
text += getattr(instance, 'host','localhost')
|
|
29
|
+
text += getattr(instance, 'host', 'localhost')
|
|
21
30
|
text += ':{}'.format(port_or_path)
|
|
22
31
|
text += '/'
|
|
23
32
|
text += str(getattr(instance, 'db', 0))
|
|
@@ -29,8 +38,8 @@ def intercept_send_command(fn, instance, *args, **kwargs):
|
|
|
29
38
|
datas = [text]
|
|
30
39
|
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
31
40
|
async_sender.send_packet(PacketTypeEnum.TX_DB_CONN, ctx, datas)
|
|
32
|
-
query = " ".join([
|
|
33
|
-
|
|
41
|
+
query = f"{command} " + " ".join([str(arg)[:20] for arg in args[1:]])
|
|
42
|
+
|
|
34
43
|
start_time = DateUtil.nowSystem()
|
|
35
44
|
ctx.start_time = start_time
|
|
36
45
|
ctx.active_sqlhash = query
|
|
@@ -42,26 +51,29 @@ def intercept_send_command(fn, instance, *args, **kwargs):
|
|
|
42
51
|
interceptor_step_error(e)
|
|
43
52
|
finally:
|
|
44
53
|
ctx.db_opening = False
|
|
45
|
-
datas = [ctx.lctx.get('dbc', ''), query]
|
|
54
|
+
datas = [ctx.lctx.get('dbc', ''), query, 0]
|
|
46
55
|
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
47
|
-
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx,
|
|
48
|
-
datas)
|
|
56
|
+
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx, datas)
|
|
49
57
|
|
|
50
58
|
|
|
51
59
|
def interceptor_read_response(fn, *args, **kwargs):
|
|
60
|
+
global _current_command
|
|
61
|
+
|
|
62
|
+
if _current_command not in {'SET', 'GET', 'DEL', 'HSET', 'HGET'}:
|
|
63
|
+
_current_command = None
|
|
64
|
+
return fn(*args, **kwargs)
|
|
65
|
+
|
|
52
66
|
ctx = TraceContextManager.getLocalContext()
|
|
53
67
|
if not ctx:
|
|
68
|
+
_current_command = None
|
|
54
69
|
return fn(*args, **kwargs)
|
|
70
|
+
|
|
55
71
|
start_time = DateUtil.nowSystem()
|
|
56
72
|
ctx.start_time = start_time
|
|
57
73
|
|
|
58
|
-
callback = None
|
|
59
74
|
try:
|
|
60
75
|
callback = fn(*args, **kwargs)
|
|
61
|
-
|
|
62
|
-
except Exception as e:
|
|
63
|
-
interceptor_step_error(e)
|
|
64
|
-
finally:
|
|
76
|
+
|
|
65
77
|
if callback:
|
|
66
78
|
count = -1
|
|
67
79
|
if isinstance(callback, int):
|
|
@@ -71,11 +83,15 @@ def interceptor_read_response(fn, *args, **kwargs):
|
|
|
71
83
|
|
|
72
84
|
if count > -1:
|
|
73
85
|
msg = '{0}: {1}'.format('Fetch bytes', count)
|
|
74
|
-
datas = [
|
|
86
|
+
datas = [msg, ' ', ' ']
|
|
75
87
|
ctx.elapsed = 0
|
|
76
88
|
async_sender.send_packet(PacketTypeEnum.TX_MSG, ctx, datas)
|
|
77
89
|
|
|
78
90
|
ctx.active_sqlhash = 0
|
|
91
|
+
return callback
|
|
92
|
+
finally:
|
|
93
|
+
_current_command = None
|
|
94
|
+
|
|
79
95
|
|
|
80
96
|
def instrument_redis_connection(module):
|
|
81
97
|
def wrapper(fn):
|
|
@@ -83,11 +99,13 @@ def instrument_redis_connection(module):
|
|
|
83
99
|
def trace(*args, **kwargs):
|
|
84
100
|
callback = intercept_send_command(fn, args[0], *args[1:], **kwargs)
|
|
85
101
|
return callback
|
|
86
|
-
|
|
102
|
+
|
|
87
103
|
return trace
|
|
88
104
|
|
|
89
105
|
if hasattr(module, 'Connection') and hasattr(module.Connection, 'send_command'):
|
|
90
|
-
|
|
106
|
+
if not getattr(module.Connection.send_command, '_wrapped', False):
|
|
107
|
+
module.Connection.send_command = wrapper(module.Connection.send_command)
|
|
108
|
+
module.Connection.send_command._wrapped = True
|
|
91
109
|
|
|
92
110
|
def wrapper(fn):
|
|
93
111
|
@trace_handler(fn)
|
|
@@ -98,5 +116,6 @@ def instrument_redis_connection(module):
|
|
|
98
116
|
return trace
|
|
99
117
|
|
|
100
118
|
if hasattr(module, 'Connection') and hasattr(module.Connection, 'read_response'):
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
if not getattr(module.Connection.read_response, '_wrapped', False):
|
|
120
|
+
module.Connection.read_response = wrapper(module.Connection.read_response)
|
|
121
|
+
module.Connection.read_response._wrapped = True
|
|
@@ -85,7 +85,7 @@ def instrument_sqlalchemy_engine(module):
|
|
|
85
85
|
# print('instrument_sqlalchemy_engine 6')
|
|
86
86
|
ctx = TraceContextManager.getLocalContext()
|
|
87
87
|
if ctx:
|
|
88
|
-
datas = [ctx.lctx.get('dbc', ''), query]
|
|
88
|
+
datas = [ctx.lctx.get('dbc', ''), query, 0]
|
|
89
89
|
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
90
90
|
# print('instrument_sqlalchemy_engine 6.1', datas)
|
|
91
91
|
async_sender.send_packet(PacketTypeEnum.TX_SQL, ctx,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|