whatap-python 1.8.8__tar.gz → 1.8.9__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.

Files changed (144) hide show
  1. {whatap_python-1.8.8 → whatap_python-1.8.9}/PKG-INFO +1 -1
  2. whatap_python-1.8.9/whatap/build.py +4 -0
  3. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/wsgi.py +66 -27
  4. whatap_python-1.8.9/whatap/trace/mod/database/sqlite3.py +124 -0
  5. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/trace_module_definition.py +31 -22
  6. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/PKG-INFO +1 -1
  7. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/SOURCES.txt +1 -0
  8. whatap_python-1.8.8/whatap/build.py +0 -4
  9. {whatap_python-1.8.8 → whatap_python-1.8.9}/README.md +0 -0
  10. {whatap_python-1.8.8 → whatap_python-1.8.9}/setup.cfg +0 -0
  11. {whatap_python-1.8.8 → whatap_python-1.8.9}/setup.py +0 -0
  12. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/LICENSE +0 -0
  13. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/README.rst +0 -0
  14. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/__init__.py +0 -0
  15. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/__main__.py +0 -0
  16. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/agent/darwin/amd64/whatap_python +0 -0
  17. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/agent/darwin/arm64/whatap_python +0 -0
  18. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/agent/linux/amd64/whatap_python +0 -0
  19. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/agent/linux/arm64/whatap_python +0 -0
  20. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/bootstrap/__init__.py +0 -0
  21. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/bootstrap/sitecustomize.py +0 -0
  22. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/conf/__init__.py +0 -0
  23. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/conf/configuration.py +0 -0
  24. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/conf/configure.py +0 -0
  25. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/conf/license.py +0 -0
  26. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/control/__init__.py +0 -0
  27. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/counter/__init__.py +0 -0
  28. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/counter/counter_manager.py +0 -0
  29. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/counter/tasks/__init__.py +0 -0
  30. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/counter/tasks/openfiledescriptor.py +0 -0
  31. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/io/__init__.py +0 -0
  32. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/io/data_inputx.py +0 -0
  33. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/io/data_outputx.py +0 -0
  34. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/__init__.py +0 -0
  35. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/async_sender.py +0 -0
  36. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/packet_enum.py +0 -0
  37. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/packet_type_enum.py +0 -0
  38. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/param_def.py +0 -0
  39. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/stackhelper.py +0 -0
  40. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/udp_session.py +0 -0
  41. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/net/udp_thread.py +0 -0
  42. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/pack/__init__.py +0 -0
  43. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/pack/logSinkPack.py +0 -0
  44. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/pack/pack.py +0 -0
  45. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/pack/pack_enum.py +0 -0
  46. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/pack/tagCountPack.py +0 -0
  47. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/scripts/__init__.py +0 -0
  48. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/__init__.py +0 -0
  49. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/__init__.py +0 -0
  50. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/amqp/__init__.py +0 -0
  51. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/amqp/kombu.py +0 -0
  52. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/amqp/pika.py +0 -0
  53. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/__init__.py +0 -0
  54. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/bottle.py +0 -0
  55. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/celery.py +0 -0
  56. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/cherrypy.py +0 -0
  57. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/django.py +0 -0
  58. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/django_asgi.py +0 -0
  59. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/django_py3.py +0 -0
  60. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/fastapi.py +0 -0
  61. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/flask.py +0 -0
  62. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/frappe.py +0 -0
  63. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/graphql.py +0 -0
  64. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/nameko.py +0 -0
  65. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/odoo.py +0 -0
  66. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/starlette.py +0 -0
  67. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/application/tornado.py +0 -0
  68. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/__init__.py +0 -0
  69. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/cxoracle.py +0 -0
  70. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/mongo.py +0 -0
  71. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/mysql.py +0 -0
  72. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/neo4j.py +0 -0
  73. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/postgresql.py +0 -0
  74. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/redis.py +0 -0
  75. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/database/toolkit.py +0 -0
  76. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/email/__init__.py +0 -0
  77. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/email/smtp.py +0 -0
  78. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/__init__.py +0 -0
  79. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/django.py +0 -0
  80. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/httplib.py +0 -0
  81. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/httpx.py +0 -0
  82. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/requests.py +0 -0
  83. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/httpc/urllib3.py +0 -0
  84. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/llm/__init__.py +0 -0
  85. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/llm/openai.py +0 -0
  86. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/logging.py +0 -0
  87. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/plugin.py +0 -0
  88. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/standalone/__init__.py +0 -0
  89. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/standalone/multiple.py +0 -0
  90. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/mod/standalone/single.py +0 -0
  91. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/simple_trace_context.py +0 -0
  92. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/trace_context.py +0 -0
  93. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/trace_context_manager.py +0 -0
  94. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/trace/trace_import.py +0 -0
  95. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/__init__.py +0 -0
  96. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/bit_util.py +0 -0
  97. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/cardinality/__init__.py +0 -0
  98. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/cardinality/hyperloglog.py +0 -0
  99. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/cardinality/murmurhash.py +0 -0
  100. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/cardinality/registerset.py +0 -0
  101. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/compare_util.py +0 -0
  102. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/date_util.py +0 -0
  103. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/debug_util.py +0 -0
  104. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/escape_literal_sql.py +0 -0
  105. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/hash_util.py +0 -0
  106. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/hexa32.py +0 -0
  107. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/int_set.py +0 -0
  108. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/ip_util.py +0 -0
  109. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/keygen.py +0 -0
  110. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/linked_list.py +0 -0
  111. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/linked_map.py +0 -0
  112. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/metering_util.py +0 -0
  113. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/request_double_queue.py +0 -0
  114. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/request_queue.py +0 -0
  115. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/string_util.py +0 -0
  116. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/throttle_util.py +0 -0
  117. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/util/userid_util.py +0 -0
  118. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/__init__.py +0 -0
  119. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/blob_value.py +0 -0
  120. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/boolean_value.py +0 -0
  121. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/decimal_value.py +0 -0
  122. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/double_summary.py +0 -0
  123. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/double_value.py +0 -0
  124. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/float_array.py +0 -0
  125. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/float_value.py +0 -0
  126. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/int_array.py +0 -0
  127. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/ip4_value.py +0 -0
  128. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/list_value.py +0 -0
  129. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/long_array.py +0 -0
  130. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/long_summary.py +0 -0
  131. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/map_value.py +0 -0
  132. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/null_value.py +0 -0
  133. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/number_value.py +0 -0
  134. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/summary_value.py +0 -0
  135. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/text_array.py +0 -0
  136. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/text_hash_value.py +0 -0
  137. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/text_value.py +0 -0
  138. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/value.py +0 -0
  139. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/value/value_enum.py +0 -0
  140. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap/whatap.conf +0 -0
  141. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/dependency_links.txt +0 -0
  142. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/entry_points.txt +0 -0
  143. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/not-zip-safe +0 -0
  144. {whatap_python-1.8.8 → whatap_python-1.8.9}/whatap_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: whatap-python
3
- Version: 1.8.8
3
+ Version: 1.8.9
4
4
  Summary: Monitoring and Profiling Service
5
5
  Home-page: https://www.whatap.io
6
6
  Author: whatap
@@ -0,0 +1,4 @@
1
+ app = 'Python'
2
+ name = 'whatap-python'
3
+ version = '1.8.9'
4
+ release_date = '20250812'
@@ -403,11 +403,17 @@ def interceptor_db_con(fn, db_info, *args, **kwargs):
403
403
  kwargs = dict(
404
404
  x.split('=') for x in re.sub(r'\s*=\s*', '=', args[0]).split())
405
405
 
406
- text = '{}://'.format(db_info.get('type'))
407
- text += kwargs.get('user' , '')
408
- text += "@"
409
- text += kwargs.get('host', kwargs.get('dsn', ''))
410
- text += '/'
406
+ db_type = db_info.get('type')
407
+
408
+ if db_type == "sqlite":
409
+ text = "sqlite:"
410
+ else:
411
+ text = '{}://'.format(db_type)
412
+ text += kwargs.get('user', '')
413
+ text += "@"
414
+ text += kwargs.get('host', kwargs.get('dsn', ''))
415
+ text += '/'
416
+
411
417
  text += kwargs.get('database', kwargs.get('db', kwargs.get('dbname', '')))
412
418
  ctx.active_dbc = text
413
419
  ctx.lctx['dbc'] = text
@@ -445,14 +451,58 @@ def addQuoteList(arg_list):
445
451
  return tuple(quoted_list)
446
452
 
447
453
  def neo4jQuery(query,paremeter):
448
- transformed_query = query
454
+ neo4j_query = query
449
455
 
450
456
  for key, value in paremeter.items():
451
457
  placeholder = f"${key}"
452
458
  replacement = f"'{str(value)}'"
453
- transformed_query = transformed_query.replace(placeholder, replacement)
454
-
455
- return transformed_query
459
+ neo4j_query = neo4j_query.replace(placeholder, replacement)
460
+
461
+ return neo4j_query
462
+
463
+ def sqliteQuery(query, paremeter):
464
+ sqlite_query = query
465
+
466
+ def quote(v):
467
+ if v is None: return "NULL"
468
+ if isinstance(v, (bytes, bytearray)): return "X'" + v.hex() + "'"
469
+ return "'" + str(v).replace("'", "''") + "'"
470
+
471
+ # 이름 기반: :name / @name / $name (단일 세트)
472
+ if isinstance(paremeter, dict):
473
+ for pfx in (':', '@', '$'):
474
+ for k, v in paremeter.items():
475
+ sqlite_query = sqlite_query.replace(f"{pfx}{k}", quote(v))
476
+ return sqlite_query
477
+
478
+ # 포지셔널 + executemany 분기
479
+ if isinstance(paremeter, (list, tuple)):
480
+ # ── executemany: [tuple|dict, ...] ──
481
+ if isinstance(paremeter, list) and paremeter and isinstance(paremeter[0], (tuple, dict)):
482
+ stmts = []
483
+ for params in paremeter:
484
+ sqlite_query = query
485
+ if isinstance(params, dict):
486
+ for pfx in (':', '@', '$'):
487
+ for k, v in params.items():
488
+ sqlite_query = sqlite_query.replace(f"{pfx}{k}", quote(v))
489
+ else: # tuple
490
+ for i, v in enumerate(params, 1):
491
+ sqlite_query = sqlite_query.replace(f"?{i}", quote(v))
492
+ for v in params:
493
+ sqlite_query = sqlite_query.replace('?', quote(v), 1)
494
+ stmts.append(sqlite_query)
495
+ return ";\n".join(stmts)
496
+
497
+ # ── 단일 포지셔널 세트 (tuple 또는 스칼라 list) ──
498
+ seq = paremeter if isinstance(paremeter, tuple) else tuple(paremeter)
499
+ for i, v in enumerate(seq, 1):
500
+ sqlite_query = sqlite_query.replace(f"?{i}", quote(v))
501
+ for v in seq:
502
+ sqlite_query = sqlite_query.replace('?', quote(v), 1)
503
+ return sqlite_query
504
+
505
+ return sqlite_query
456
506
 
457
507
  def interceptor_db_execute(fn, db_info, *args, **kwargs):
458
508
  ctx = TraceContextManager.getLocalContext()
@@ -466,6 +516,13 @@ def interceptor_db_execute(fn, db_info, *args, **kwargs):
466
516
  query = neo4jQuery(args[1], kwargs)
467
517
  except Exception as e:
468
518
  pass
519
+
520
+ elif db_type == "sqlite" and len(args) > 2:
521
+ try:
522
+ query = sqliteQuery(args[1],args[2])
523
+ except Exception as e:
524
+ pass
525
+
469
526
  else:
470
527
  if len(args) > 2 and type(args[2]) == dict and args[2]:
471
528
  try:
@@ -486,24 +543,6 @@ def interceptor_db_execute(fn, db_info, *args, **kwargs):
486
543
  if not query:
487
544
  return fn(*args, **kwargs)
488
545
 
489
- start_time = DateUtil.nowSystem()
490
- ctx.start_time = start_time
491
-
492
- text = '{}://'.format(db_info.get('type'))
493
- text += db_info.get('user' , '')
494
- text += "@"
495
- text += db_info.get('host', db_info.get('dsn', ''))
496
- text += '/'
497
- text += db_info.get('database', db_info.get('db', db_info.get('dbname', '')))
498
- ctx.active_dbc = text
499
- ctx.lctx['dbc'] = text
500
-
501
- ctx.active_dbc = 0
502
-
503
- datas = [text]
504
- ctx.elapsed = DateUtil.nowSystem() - start_time
505
- async_sender.send_packet(PacketTypeEnum.TX_DB_CONN, ctx, datas)
506
-
507
546
  start_time = DateUtil.nowSystem()
508
547
  ctx.start_time = start_time
509
548
  ctx.active_sqlhash = query
@@ -0,0 +1,124 @@
1
+ from whatap.trace.mod.application.wsgi import trace_handler, \
2
+ interceptor_db_con, interceptor_db_execute, interceptor_db_close
3
+
4
+ class CursorProxy:
5
+ def __init__(self, real_cursor, db_info):
6
+ self._cur = real_cursor
7
+ self._db_info = db_info
8
+
9
+ def execute_wrapper(self, original_execute_method):
10
+ owner = getattr(original_execute_method, "__self__", None)
11
+
12
+ def safe_execute(*args, **kwargs):
13
+ if args and owner is not None and args[0] is owner:
14
+ args = args[1:]
15
+ return original_execute_method(*args, **kwargs)
16
+
17
+ return safe_execute
18
+
19
+ def execute(self, *args, **kwargs):
20
+ safe_fn = self.execute_wrapper(self._cur.execute)
21
+ callback = interceptor_db_execute(safe_fn, self._db_info, self._cur, *args, **kwargs)
22
+ return callback
23
+
24
+ def executemany(self, *args, **kwargs):
25
+ safe_fn = self.execute_wrapper(self._cur.executemany)
26
+ callback = interceptor_db_execute(safe_fn, self._db_info, self._cur, *args, **kwargs)
27
+ return callback
28
+
29
+ def executescript(self, *args, **kwargs):
30
+ safe_fn = self.execute_wrapper(self._cur.executescript)
31
+ callback = interceptor_db_execute(safe_fn, self._db_info, self._cur, *args, **kwargs)
32
+ return callback
33
+
34
+ def close(self, *args, **kwargs):
35
+ callback = self._cur.close(*args, **kwargs)
36
+ return callback
37
+
38
+ def __enter__(self):
39
+ self._cur.__enter__()
40
+ return self
41
+
42
+ def __exit__(self, exc_type, exc_val, exc_tb):
43
+ return self._cur.__exit__(exc_type, exc_val, exc_tb)
44
+
45
+ def __getattr__(self, name):
46
+ return getattr(self._cur, name)
47
+
48
+
49
+ class ConnectionProxy:
50
+ def __init__(self, real_connection, db_info):
51
+ self._real_connection = real_connection
52
+ self._db_info = db_info
53
+
54
+ def execute_wrapper(self, original_execute_method):
55
+ owner = getattr(original_execute_method, "__self__", None)
56
+
57
+ def safe_execute(*args, **kwargs):
58
+ if args and owner is not None and args[0] is owner:
59
+ args = args[1:]
60
+ return original_execute_method(*args, **kwargs)
61
+
62
+ return safe_execute
63
+
64
+ def execute(self, *args, **kwargs):
65
+ real_cursor = self._real_connection.cursor()
66
+ safe_fn = self.execute_wrapper(real_cursor.execute)
67
+ callback = interceptor_db_execute(safe_fn,self._db_info,real_cursor,*args,**kwargs)
68
+ return callback
69
+
70
+ def executemany(self, *args, **kwargs):
71
+ real_cursor = self._real_connection.cursor()
72
+ safe_fn = self.execute_wrapper(real_cursor.executemany)
73
+ callback = interceptor_db_execute(safe_fn, self._db_info, real_cursor, *args, **kwargs)
74
+ return callback
75
+
76
+ def executescript(self, *args, **kwargs):
77
+ real_cursor = self._real_connection.cursor()
78
+ safe_fn = self.execute_wrapper(real_cursor.executescript)
79
+ callback = interceptor_db_execute(safe_fn, self._db_info, real_cursor, *args, **kwargs)
80
+ return callback
81
+
82
+ def cursor(self, *args, **kwargs):
83
+ real_cursor = self._real_connection.cursor(*args, **kwargs)
84
+ return CursorProxy(real_cursor, self._db_info)
85
+
86
+ def close(self, *args, **kwargs):
87
+ callback = interceptor_db_close(self._real_connection.close, *args, **kwargs)
88
+ return callback
89
+
90
+ def __getattr__(self, name):
91
+ return getattr(self._real_connection, name)
92
+
93
+ def __enter__(self):
94
+ self._real_connection.__enter__()
95
+ return self
96
+
97
+ def __exit__(self, exc_type, exc_val, exc_tb):
98
+ return self._real_connection.__exit__(exc_type, exc_val, exc_tb)
99
+
100
+
101
+ def instrument_sqlite3(module):
102
+
103
+ def wrapper(fn):
104
+ @trace_handler(fn)
105
+ def trace(*args, **kwargs):
106
+ if args:
107
+ kwargs['database'] = args[0]
108
+ args = args[1:]
109
+
110
+ db_name = kwargs.get('database', 'unknown')
111
+ db_info = {'type': 'sqlite', 'db': db_name}
112
+ db_info.update(kwargs)
113
+
114
+ real_connection = interceptor_db_con(fn, db_info, *args, **kwargs)
115
+
116
+ if real_connection:
117
+ return ConnectionProxy(real_connection, db_info)
118
+
119
+ return real_connection
120
+
121
+ return trace
122
+
123
+ if hasattr(module, "connect"):
124
+ module.connect = wrapper(module.connect)
@@ -11,6 +11,21 @@ DEFINITION = {
11
11
  ('', 'instrument_standalone_single'),
12
12
  ('', 'instrument_standalone_multiple')
13
13
  ],
14
+ 'email.smtp': [
15
+ ('smtplib', 'instrument_smtp'),
16
+ ],
17
+ 'amqp.pika': [
18
+ ('pika.channel', 'instrument_pika'),
19
+ ],
20
+ 'llm.openai': [
21
+ ('openai', 'instrument_openai')
22
+ ],
23
+ 'logging': [
24
+ ('logging.handlers', 'instrument_logging'),
25
+ ('loguru._handler', 'instrument_loguru'),
26
+ ],
27
+
28
+
14
29
  'httpc.httplib': [
15
30
  ('httplib', 'instrument_httplib'),
16
31
  ('http.client', 'instrument_httplib'),
@@ -28,6 +43,8 @@ DEFINITION = {
28
43
  'httpc.httpx' : [
29
44
  ('httpx', 'instrument_httpx')
30
45
  ],
46
+
47
+
31
48
  'database.mysql': [
32
49
  ('MySQLdb', 'instrument_MySQLdb'),
33
50
  ('MySQLdb.cursors', 'instrument_MySQLdb_cursors'),
@@ -42,12 +59,26 @@ DEFINITION = {
42
59
  'database.neo4j': [
43
60
  ('neo4j', 'instrument_neo4j')
44
61
  ],
62
+ 'database.sqlite3': [
63
+ ('sqlite3', 'instrument_sqlite3')
64
+ ],
65
+ 'database.cxoracle':[
66
+ ('cx_Oracle', 'instrument_oracle_client'),
67
+ ],
68
+ 'database.redis': [
69
+ ('redis', 'instrument_redis_connection'),
70
+ ],
71
+ 'database.mongo': [
72
+ ('pymongo', 'instrument_mongo_client'),
73
+ ],
45
74
  'database.toolkit': [
46
75
  ('sqlalchemy.orm.session', 'instrument_sqlalchemy'),
47
76
  ('sqlalchemy.engine.default', 'instrument_sqlalchemy_engine'),
48
77
  ('sqlalchemy.engine.create', 'instrument_sqlalchemy_engine_basic'),
49
78
  ('sqlalchemy.engine', 'instrument_sqlalchemy_engine_basic'),
50
79
  ],
80
+
81
+
51
82
  'application.starlette' : [
52
83
  ('starlette.websockets' , 'instrument_starlette_websocket'),
53
84
  ],
@@ -88,15 +119,6 @@ DEFINITION = {
88
119
  ('celery.task.trace', 'instrument_celery_execute_trace'),
89
120
  ('celery.app.trace', 'instrument_celery_execute_trace'),
90
121
  ],
91
- 'database.redis':[
92
- ('redis','instrument_redis_connection'),
93
- ],
94
- 'email.smtp':[
95
- ('smtplib','instrument_smtp'),
96
- ],
97
- 'amqp.pika':[
98
- ('pika.channel','instrument_pika'),
99
- ],
100
122
  'application.nameko': [
101
123
  ('nameko.containers', 'instrument_nameko_spawn_worker'),
102
124
  ('spsengine.containers', 'instrument_nameko_spawn_worker'),
@@ -108,13 +130,6 @@ DEFINITION = {
108
130
  #graphen-core 2.x
109
131
  ('graphql.execution.executor','instrument_graphql'),
110
132
  ],
111
- 'database.mongo':[
112
- ('pymongo','instrument_mongo_client'),
113
- ],
114
- 'logging':[
115
- ('logging.handlers', 'instrument_logging'),
116
- ('loguru._handler','instrument_loguru'),
117
- ],
118
133
  'application.fastapi': [
119
134
  ('fastapi.applications', 'instrument_applications'),
120
135
  ('fastapi.routing', 'instrument'),
@@ -127,10 +142,4 @@ DEFINITION = {
127
142
  'application.odoo': [
128
143
  ('odoo', 'instrument'),
129
144
  ],
130
- 'database.cxoracle':[
131
- ('cx_Oracle', 'instrument_oracle_client'),
132
- ],
133
- 'llm.openai':[
134
- ('openai' , 'instrument_openai')
135
- ]
136
145
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: whatap-python
3
- Version: 1.8.8
3
+ Version: 1.8.9
4
4
  Summary: Monitoring and Profiling Service
5
5
  Home-page: https://www.whatap.io
6
6
  Author: whatap
@@ -74,6 +74,7 @@ whatap/trace/mod/database/mysql.py
74
74
  whatap/trace/mod/database/neo4j.py
75
75
  whatap/trace/mod/database/postgresql.py
76
76
  whatap/trace/mod/database/redis.py
77
+ whatap/trace/mod/database/sqlite3.py
77
78
  whatap/trace/mod/database/toolkit.py
78
79
  whatap/trace/mod/email/__init__.py
79
80
  whatap/trace/mod/email/smtp.py
@@ -1,4 +0,0 @@
1
- app = 'Python'
2
- name = 'whatap-python'
3
- version = '1.8.8'
4
- release_date = '20250804'
File without changes
File without changes
File without changes