whatap-python 1.8.0__tar.gz → 1.8.1__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 (130) hide show
  1. {whatap_python-1.8.0 → whatap_python-1.8.1}/PKG-INFO +2 -2
  2. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/agent/darwin/amd64/whatap_python +0 -0
  3. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/agent/darwin/arm64/whatap_python +0 -0
  4. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/agent/linux/amd64/whatap_python +0 -0
  5. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/agent/linux/arm64/whatap_python +0 -0
  6. whatap_python-1.8.1/whatap/build.py +4 -0
  7. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/conf/configuration.py +1 -0
  8. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/packet_type_enum.py +1 -0
  9. whatap_python-1.8.1/whatap/trace/mod/application_starlette.py +125 -0
  10. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/trace_module_definition.py +3 -0
  11. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/PKG-INFO +2 -2
  12. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/SOURCES.txt +1 -0
  13. whatap_python-1.8.0/whatap/build.py +0 -4
  14. {whatap_python-1.8.0 → whatap_python-1.8.1}/README.md +0 -0
  15. {whatap_python-1.8.0 → whatap_python-1.8.1}/setup.cfg +0 -0
  16. {whatap_python-1.8.0 → whatap_python-1.8.1}/setup.py +0 -0
  17. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/LICENSE +0 -0
  18. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/README.rst +0 -0
  19. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/__init__.py +0 -0
  20. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/__main__.py +0 -0
  21. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/bootstrap/__init__.py +0 -0
  22. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/bootstrap/sitecustomize.py +0 -0
  23. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/conf/__init__.py +0 -0
  24. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/conf/configure.py +0 -0
  25. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/conf/license.py +0 -0
  26. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/control/__init__.py +0 -0
  27. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/counter/__init__.py +0 -0
  28. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/counter/counter_manager.py +0 -0
  29. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/counter/tasks/__init__.py +0 -0
  30. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/counter/tasks/openfiledescriptor.py +0 -0
  31. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/io/__init__.py +0 -0
  32. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/io/data_inputx.py +0 -0
  33. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/io/data_outputx.py +0 -0
  34. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/__init__.py +0 -0
  35. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/async_sender.py +0 -0
  36. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/packet_enum.py +0 -0
  37. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/param_def.py +0 -0
  38. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/stackhelper.py +0 -0
  39. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/udp_session.py +0 -0
  40. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/net/udp_thread.py +0 -0
  41. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/pack/__init__.py +0 -0
  42. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/pack/logSinkPack.py +0 -0
  43. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/pack/pack.py +0 -0
  44. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/pack/pack_enum.py +0 -0
  45. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/pack/tagCountPack.py +0 -0
  46. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/scripts/__init__.py +0 -0
  47. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/__init__.py +0 -0
  48. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/__init__.py +0 -0
  49. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/amqp_kombu.py +0 -0
  50. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/amqp_pika.py +0 -0
  51. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_bottle.py +0 -0
  52. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_celery.py +0 -0
  53. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_cherrypy.py +0 -0
  54. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_django.py +0 -0
  55. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_django_asgi.py +0 -0
  56. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_django_py3.py +0 -0
  57. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_fastapi.py +0 -0
  58. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_flask.py +0 -0
  59. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_frappe.py +0 -0
  60. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_graphql.py +0 -0
  61. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_nameko.py +0 -0
  62. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_tornado.py +0 -0
  63. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/application_wsgi.py +0 -0
  64. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_cxoracle.py +0 -0
  65. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_mongo.py +0 -0
  66. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_mysql.py +0 -0
  67. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_postgresql.py +0 -0
  68. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_redis.py +0 -0
  69. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/database_toolkit.py +0 -0
  70. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/email_smtp.py +0 -0
  71. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/httpc_django.py +0 -0
  72. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/httpc_httplib.py +0 -0
  73. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/httpc_requests.py +0 -0
  74. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/httpc_urllib3.py +0 -0
  75. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/logging.py +0 -0
  76. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/mod/plugin.py +0 -0
  77. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/simple_trace_context.py +0 -0
  78. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/trace_context.py +0 -0
  79. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/trace_context_manager.py +0 -0
  80. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/trace/trace_import.py +0 -0
  81. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/__init__.py +0 -0
  82. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/bit_util.py +0 -0
  83. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/cardinality/__init__.py +0 -0
  84. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/cardinality/hyperloglog.py +0 -0
  85. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/cardinality/murmurhash.py +0 -0
  86. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/cardinality/registerset.py +0 -0
  87. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/compare_util.py +0 -0
  88. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/date_util.py +0 -0
  89. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/debug_util.py +0 -0
  90. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/escape_literal_sql.py +0 -0
  91. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/hash_util.py +0 -0
  92. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/hexa32.py +0 -0
  93. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/int_set.py +0 -0
  94. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/ip_util.py +0 -0
  95. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/keygen.py +0 -0
  96. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/linked_list.py +0 -0
  97. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/linked_map.py +0 -0
  98. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/metering_util.py +0 -0
  99. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/request_double_queue.py +0 -0
  100. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/request_queue.py +0 -0
  101. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/string_util.py +0 -0
  102. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/throttle_util.py +0 -0
  103. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/util/userid_util.py +0 -0
  104. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/__init__.py +0 -0
  105. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/blob_value.py +0 -0
  106. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/boolean_value.py +0 -0
  107. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/decimal_value.py +0 -0
  108. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/double_summary.py +0 -0
  109. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/double_value.py +0 -0
  110. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/float_array.py +0 -0
  111. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/float_value.py +0 -0
  112. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/int_array.py +0 -0
  113. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/ip4_value.py +0 -0
  114. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/list_value.py +0 -0
  115. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/long_array.py +0 -0
  116. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/long_summary.py +0 -0
  117. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/map_value.py +0 -0
  118. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/null_value.py +0 -0
  119. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/number_value.py +0 -0
  120. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/summary_value.py +0 -0
  121. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/text_array.py +0 -0
  122. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/text_hash_value.py +0 -0
  123. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/text_value.py +0 -0
  124. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/value.py +0 -0
  125. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/value/value_enum.py +0 -0
  126. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap/whatap.conf +0 -0
  127. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/dependency_links.txt +0 -0
  128. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/entry_points.txt +0 -0
  129. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/not-zip-safe +0 -0
  130. {whatap_python-1.8.0 → whatap_python-1.8.1}/whatap_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: whatap-python
3
- Version: 1.8.0
3
+ Version: 1.8.1
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.1'
4
+ release_date = '20250423'
@@ -12,6 +12,7 @@ Configuration = {
12
12
  "trace_loguru_mtid_enabled": False,
13
13
  "trace_ignore_url_set": [],
14
14
  "trace_ignore_url_prefix": None,
15
+ "trace_websocket_enabled": False,
15
16
 
16
17
  "debug": False,
17
18
  "query_string_enabled": False,
@@ -18,6 +18,7 @@ class PacketTypeEnum(object):
18
18
  # secure msg
19
19
  TX_SECURE_MSG = 13
20
20
 
21
+ TX_WEB_SOCKET = 16
21
22
  TX_END = 255
22
23
 
23
24
  TX_PARAM = 30
@@ -0,0 +1,125 @@
1
+ import whatap.net.async_sender as async_sender
2
+ from whatap.trace.trace_context import TraceContext
3
+ from whatap.trace.trace_context_manager import TraceContextManager
4
+ from whatap.net.packet_type_enum import PacketTypeEnum
5
+ from whatap.util.date_util import DateUtil
6
+ from whatap.util.userid_util import UseridUtil as userid_util
7
+ from whatap.trace.mod.application_wsgi import interceptor_step_error, \
8
+ start_interceptor,end_interceptor
9
+ from whatap.conf.configure import Configure as conf
10
+ from typing import Any
11
+
12
+
13
+
14
+ def intercept_websocket(web_socket, data: str):
15
+ try:
16
+ ctx = TraceContext()
17
+
18
+ scope = web_socket.scope
19
+ headers = dict(scope.get("headers", [])) # headers는 리스트(tuple) 형태
20
+ query_string = scope.get("query_string", b'').decode()
21
+ client = scope.get("client", ("0.0.0.0", 0))
22
+
23
+ # 기본 ctx 설정
24
+ ctx.service_name = scope.get("path", "WebSocket")
25
+ if query_string:
26
+ ctx.service_name += f"?{query_string}"
27
+ ctx.http_method = "WEBSOCKET"
28
+ ctx.remoteIp = client[0]
29
+ ctx.port = client[1]
30
+
31
+ # User-Agent, Referer 추출 (바이트를 디코딩)
32
+ ctx.userAgentString = headers.get(b'user-agent', b'').decode()
33
+ ctx.referer = headers.get(b'referer', b'').decode()
34
+
35
+ # userid 관련
36
+ if conf.trace_user_enabled:
37
+ if conf.trace_user_using_ip:
38
+ ctx.userid = ctx.remoteIp
39
+ else:
40
+ ctx.userid, ctx._rawuserid = userid_util.getUserId([scope], ctx.remoteIp)
41
+
42
+ # 트랜잭션 전파 관련
43
+ mstt = headers.get(f"HTTP_{conf._trace_mtrace_caller_key}".encode(), b'').decode()
44
+ if mstt:
45
+ ctx.setTransfer(mstt)
46
+ if conf.stat_mtrace_enabled:
47
+ val = headers.get(f"HTTP_{conf._trace_mtrace_info_key}".encode(), b'').decode()
48
+ if val:
49
+ ctx.setTransferInfo(val)
50
+ txid = headers.get(f"HTTP_{conf._trace_mtrace_callee_key}".encode(), b'').decode()
51
+ if txid:
52
+ ctx.setTxid(txid)
53
+
54
+ poid = headers.get(f"HTTP_{conf._trace_mtrace_caller_poid_key}".encode(), b'').decode()
55
+ if poid:
56
+ ctx.mcaller_poid = poid
57
+
58
+ start_interceptor(ctx)
59
+
60
+ start_time = DateUtil.nowSystem()
61
+ ctx.start_time = start_time
62
+ ctx.error = 0
63
+ ctx.elapsed = 0
64
+
65
+ datas = [ctx.remoteIp, ctx.port, ctx.elapsed, ctx.error]
66
+ async_sender.send_packet(PacketTypeEnum.TX_WEB_SOCKET, ctx, datas)
67
+
68
+ except Exception as e:
69
+ interceptor_step_error(e)
70
+ finally:
71
+ end_interceptor(ctx=ctx)
72
+
73
+
74
+ def instrument_starlette_websocket(module):
75
+
76
+ if not conf.trace_websocket_enabled:
77
+ return
78
+
79
+ OriginalWebSocket = module.WebSocket
80
+ if getattr(OriginalWebSocket, "_whatap_patched", False):
81
+ return
82
+
83
+ #original_accept = OriginalWebSocket.accept
84
+ original_send_text = OriginalWebSocket.send_text
85
+ original_send_bytes = OriginalWebSocket.send_bytes
86
+ original_send_json = OriginalWebSocket.send_json
87
+
88
+
89
+ # # 연결 시점도 래핑은 하지만, APM 인터셉트는 하지 않음
90
+ # async def wrapped_accept(self, *args, **kwargs):
91
+ # try:
92
+ # pass
93
+ # except Exception as e:
94
+ # interceptor_step_error(e)
95
+ # return await original_accept(self, *args, **kwargs)
96
+
97
+ async def wrapped_send_text(self, data: str):
98
+ try:
99
+ intercept_websocket(self, data)
100
+ except Exception as e:
101
+ interceptor_step_error(e)
102
+ return await original_send_text(self, data)
103
+
104
+ async def wrapped_send_bytes(self, data: bytes):
105
+ try:
106
+ intercept_websocket(self, None)
107
+ except Exception as e:
108
+ interceptor_step_error(e)
109
+ return await original_send_bytes(self, data)
110
+
111
+ async def wrapped_send_json(self, data: Any):
112
+ try:
113
+ intercept_websocket(self, None)
114
+ except Exception as e:
115
+ interceptor_step_error(e)
116
+ return await original_send_json(self, data)
117
+
118
+ #OriginalWebSocket.accept = wrapped_accept
119
+ OriginalWebSocket.send_text = wrapped_send_text
120
+ OriginalWebSocket.send_bytes = wrapped_send_bytes
121
+ OriginalWebSocket.send_json = wrapped_send_json
122
+ OriginalWebSocket._whatap_patched = True
123
+
124
+
125
+
@@ -38,6 +38,9 @@ DEFINITION = {
38
38
  ('sqlalchemy.engine.create', 'instrument_sqlalchemy_engine_basic'),
39
39
  ('sqlalchemy.engine', 'instrument_sqlalchemy_engine_basic'),
40
40
  ],
41
+ 'application_starlette' : [
42
+ ('starlette.websockets' , 'instrument_starlette_websocket'),
43
+ ],
41
44
  'application_wsgi': [
42
45
  ('', ''),
43
46
  ],
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: whatap-python
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Monitoring and Profiling Service
5
5
  Home-page: https://www.whatap.io
6
6
  Author: whatap
@@ -59,6 +59,7 @@ whatap/trace/mod/application_flask.py
59
59
  whatap/trace/mod/application_frappe.py
60
60
  whatap/trace/mod/application_graphql.py
61
61
  whatap/trace/mod/application_nameko.py
62
+ whatap/trace/mod/application_starlette.py
62
63
  whatap/trace/mod/application_tornado.py
63
64
  whatap/trace/mod/application_wsgi.py
64
65
  whatap/trace/mod/database_cxoracle.py
@@ -1,4 +0,0 @@
1
- app = 'Python'
2
- name = 'whatap-python'
3
- version = '1.8.0'
4
- release_date = '20250414'
File without changes
File without changes
File without changes