whatap-python 2.1.0__py3-none-any.whl

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.
Files changed (227) hide show
  1. whatap/LICENSE +0 -0
  2. whatap/README.rst +49 -0
  3. whatap/__init__.py +923 -0
  4. whatap/__main__.py +4 -0
  5. whatap/agent/darwin/amd64/whatap_python +0 -0
  6. whatap/agent/darwin/arm64/whatap_python +0 -0
  7. whatap/agent/linux/amd64/whatap_python +0 -0
  8. whatap/agent/linux/arm64/whatap_python +0 -0
  9. whatap/agent/windows/whatap_python.exe +0 -0
  10. whatap/bootstrap/__init__.py +0 -0
  11. whatap/bootstrap/sitecustomize.py +19 -0
  12. whatap/build.py +4 -0
  13. whatap/conf/__init__.py +0 -0
  14. whatap/conf/configuration.py +280 -0
  15. whatap/conf/configure.py +105 -0
  16. whatap/conf/license.py +49 -0
  17. whatap/control/__init__.py +0 -0
  18. whatap/counter/__init__.py +14 -0
  19. whatap/counter/counter_manager.py +45 -0
  20. whatap/counter/tasks/__init__.py +3 -0
  21. whatap/counter/tasks/base_task.py +26 -0
  22. whatap/counter/tasks/llm_evaluator_task.py +501 -0
  23. whatap/counter/tasks/llm_log_sink_task.py +309 -0
  24. whatap/counter/tasks/llm_stat_task.py +78 -0
  25. whatap/counter/tasks/openfiledescriptor.py +67 -0
  26. whatap/io/__init__.py +1 -0
  27. whatap/io/data_inputx.py +161 -0
  28. whatap/io/data_outputx.py +262 -0
  29. whatap/llm/__init__.py +17 -0
  30. whatap/llm/definitions.py +43 -0
  31. whatap/llm/evaluators/__init__.py +136 -0
  32. whatap/llm/evaluators/base.py +114 -0
  33. whatap/llm/evaluators/builtins/__init__.py +91 -0
  34. whatap/llm/evaluators/builtins/answer_relevance.py +46 -0
  35. whatap/llm/evaluators/builtins/combined_judge.py +271 -0
  36. whatap/llm/evaluators/builtins/factuality.py +71 -0
  37. whatap/llm/evaluators/builtins/hallucination.py +97 -0
  38. whatap/llm/evaluators/builtins/llm_judge.py +516 -0
  39. whatap/llm/evaluators/builtins/pii_leak.py +214 -0
  40. whatap/llm/evaluators/builtins/prompt_injection.py +71 -0
  41. whatap/llm/evaluators/builtins/toxicity.py +53 -0
  42. whatap/llm/evaluators/builtins/url_scan.py +194 -0
  43. whatap/llm/evaluators/registry.py +192 -0
  44. whatap/llm/evaluators/sampler.py +83 -0
  45. whatap/llm/evaluators/scope.py +334 -0
  46. whatap/llm/features.py +66 -0
  47. whatap/llm/log_sink_packs/__init__.py +9 -0
  48. whatap/llm/log_sink_packs/llm_input_message.py +16 -0
  49. whatap/llm/log_sink_packs/llm_log_sink_pack.py +72 -0
  50. whatap/llm/log_sink_packs/llm_output_message.py +19 -0
  51. whatap/llm/log_sink_packs/llm_step_eval_status.py +94 -0
  52. whatap/llm/log_sink_packs/llm_step_status.py +118 -0
  53. whatap/llm/log_sink_packs/llm_system_message.py +16 -0
  54. whatap/llm/log_sink_packs/llm_tool_calls.py +44 -0
  55. whatap/llm/log_sink_packs/llm_tool_results.py +16 -0
  56. whatap/llm/log_sink_packs/llm_tx_status.py +108 -0
  57. whatap/llm/pricing.py +236 -0
  58. whatap/llm/prompt_meta.py +288 -0
  59. whatap/llm/providers/__init__.py +0 -0
  60. whatap/llm/providers/anthropic/__init__.py +37 -0
  61. whatap/llm/providers/anthropic/messages/__init__.py +0 -0
  62. whatap/llm/providers/anthropic/messages/messages.py +70 -0
  63. whatap/llm/providers/anthropic/messages/messages_context.py +76 -0
  64. whatap/llm/providers/anthropic/messages/messages_extractor.py +126 -0
  65. whatap/llm/providers/interceptor.py +182 -0
  66. whatap/llm/providers/openai/__init__.py +133 -0
  67. whatap/llm/providers/openai/chat/__init__.py +0 -0
  68. whatap/llm/providers/openai/chat/chat.py +82 -0
  69. whatap/llm/providers/openai/chat/chat_context.py +78 -0
  70. whatap/llm/providers/openai/chat/chat_extractor.py +127 -0
  71. whatap/llm/providers/openai/completions/__init__.py +0 -0
  72. whatap/llm/providers/openai/completions/completions.py +70 -0
  73. whatap/llm/providers/openai/completions/completions_context.py +31 -0
  74. whatap/llm/providers/openai/completions/completions_extractor.py +61 -0
  75. whatap/llm/providers/openai/content_parser.py +41 -0
  76. whatap/llm/providers/openai/embeddings/__init__.py +0 -0
  77. whatap/llm/providers/openai/embeddings/embeddings.py +59 -0
  78. whatap/llm/providers/openai/embeddings/embeddings_context.py +25 -0
  79. whatap/llm/providers/openai/embeddings/embeddings_extractor.py +26 -0
  80. whatap/llm/providers/openai/responses/__init__.py +0 -0
  81. whatap/llm/providers/openai/responses/responses.py +70 -0
  82. whatap/llm/providers/openai/responses/responses_context.py +88 -0
  83. whatap/llm/providers/openai/responses/responses_extractor.py +126 -0
  84. whatap/llm/providers/stream_accumulator.py +73 -0
  85. whatap/llm/stats/__init__.py +35 -0
  86. whatap/llm/stats/active_stat.py +86 -0
  87. whatap/llm/stats/answer_relevance_eval_stat.py +10 -0
  88. whatap/llm/stats/api_status_stat.py +35 -0
  89. whatap/llm/stats/base_stat.py +107 -0
  90. whatap/llm/stats/combined_judge_eval_stat.py +11 -0
  91. whatap/llm/stats/error_stat.py +59 -0
  92. whatap/llm/stats/eval_stat.py +225 -0
  93. whatap/llm/stats/factuality_eval_stat.py +10 -0
  94. whatap/llm/stats/feature_stat.py +104 -0
  95. whatap/llm/stats/finish_stat.py +105 -0
  96. whatap/llm/stats/hallucination_eval_stat.py +10 -0
  97. whatap/llm/stats/meter.py +18 -0
  98. whatap/llm/stats/perf_stat.py +117 -0
  99. whatap/llm/stats/pii_leak_eval_stat.py +12 -0
  100. whatap/llm/stats/prompt_injection_eval_stat.py +10 -0
  101. whatap/llm/stats/token_usage_stat.py +133 -0
  102. whatap/llm/stats/toxicity_eval_stat.py +10 -0
  103. whatap/llm/stats/url_scan_eval_stat.py +12 -0
  104. whatap/net/__init__.py +0 -0
  105. whatap/net/async_sender.py +107 -0
  106. whatap/net/packet_enum.py +44 -0
  107. whatap/net/packet_type_enum.py +31 -0
  108. whatap/net/param_def.py +69 -0
  109. whatap/net/stackhelper.py +87 -0
  110. whatap/net/udp_session.py +394 -0
  111. whatap/net/udp_thread.py +54 -0
  112. whatap/pack/__init__.py +0 -0
  113. whatap/pack/logSinkPack.py +77 -0
  114. whatap/pack/pack.py +34 -0
  115. whatap/pack/pack_enum.py +41 -0
  116. whatap/pack/tagCountPack.py +61 -0
  117. whatap/scripts/__init__.py +208 -0
  118. whatap/trace/__init__.py +12 -0
  119. whatap/trace/mod/__init__.py +0 -0
  120. whatap/trace/mod/amqp/__init__.py +0 -0
  121. whatap/trace/mod/amqp/kombu.py +122 -0
  122. whatap/trace/mod/amqp/pika.py +62 -0
  123. whatap/trace/mod/application/__init__.py +0 -0
  124. whatap/trace/mod/application/bottle.py +34 -0
  125. whatap/trace/mod/application/celery.py +81 -0
  126. whatap/trace/mod/application/cherrypy.py +30 -0
  127. whatap/trace/mod/application/django.py +287 -0
  128. whatap/trace/mod/application/django_asgi.py +266 -0
  129. whatap/trace/mod/application/django_py3.py +251 -0
  130. whatap/trace/mod/application/fastapi/__init__.py +31 -0
  131. whatap/trace/mod/application/fastapi/endpoint.py +73 -0
  132. whatap/trace/mod/application/fastapi/exception_log.py +63 -0
  133. whatap/trace/mod/application/fastapi/instrumentation.py +204 -0
  134. whatap/trace/mod/application/fastapi/scope.py +115 -0
  135. whatap/trace/mod/application/fastapi/transaction.py +67 -0
  136. whatap/trace/mod/application/flask.py +52 -0
  137. whatap/trace/mod/application/frappe.py +224 -0
  138. whatap/trace/mod/application/graphql.py +170 -0
  139. whatap/trace/mod/application/nameko.py +39 -0
  140. whatap/trace/mod/application/odoo.py +63 -0
  141. whatap/trace/mod/application/starlette.py +126 -0
  142. whatap/trace/mod/application/tornado.py +163 -0
  143. whatap/trace/mod/application/wsgi.py +195 -0
  144. whatap/trace/mod/database/__init__.py +0 -0
  145. whatap/trace/mod/database/cxoracle.py +49 -0
  146. whatap/trace/mod/database/mongo.py +169 -0
  147. whatap/trace/mod/database/mysql.py +80 -0
  148. whatap/trace/mod/database/neo4j.py +90 -0
  149. whatap/trace/mod/database/psycopg2.py +45 -0
  150. whatap/trace/mod/database/psycopg3.py +359 -0
  151. whatap/trace/mod/database/redis.py +122 -0
  152. whatap/trace/mod/database/sqlalchemy.py +213 -0
  153. whatap/trace/mod/database/sqlite3.py +130 -0
  154. whatap/trace/mod/database/util.py +630 -0
  155. whatap/trace/mod/email/__init__.py +0 -0
  156. whatap/trace/mod/email/smtp.py +78 -0
  157. whatap/trace/mod/httpc/__init__.py +0 -0
  158. whatap/trace/mod/httpc/django.py +31 -0
  159. whatap/trace/mod/httpc/httplib.py +70 -0
  160. whatap/trace/mod/httpc/httpx.py +62 -0
  161. whatap/trace/mod/httpc/requests.py +20 -0
  162. whatap/trace/mod/httpc/urllib3.py +27 -0
  163. whatap/trace/mod/httpc/util.py +388 -0
  164. whatap/trace/mod/logging.py +161 -0
  165. whatap/trace/mod/plugin.py +84 -0
  166. whatap/trace/mod/standalone/__init__.py +0 -0
  167. whatap/trace/mod/standalone/multiple.py +293 -0
  168. whatap/trace/mod/standalone/single.py +135 -0
  169. whatap/trace/simple_trace_context.py +18 -0
  170. whatap/trace/trace_context.py +212 -0
  171. whatap/trace/trace_context_manager.py +244 -0
  172. whatap/trace/trace_error.py +84 -0
  173. whatap/trace/trace_handler.py +89 -0
  174. whatap/trace/trace_import.py +91 -0
  175. whatap/trace/trace_module_definition.py +156 -0
  176. whatap/util/__init__.py +0 -0
  177. whatap/util/bit_util.py +49 -0
  178. whatap/util/cardinality/__init__.py +0 -0
  179. whatap/util/cardinality/hyperloglog.py +84 -0
  180. whatap/util/cardinality/murmurhash.py +20 -0
  181. whatap/util/cardinality/registerset.py +60 -0
  182. whatap/util/compare_util.py +19 -0
  183. whatap/util/date_util.py +55 -0
  184. whatap/util/debug_util.py +73 -0
  185. whatap/util/escape_literal_sql.py +233 -0
  186. whatap/util/frame_util.py +20 -0
  187. whatap/util/hash_util.py +103 -0
  188. whatap/util/hexa32.py +66 -0
  189. whatap/util/int_set.py +199 -0
  190. whatap/util/ip_util.py +63 -0
  191. whatap/util/keygen.py +11 -0
  192. whatap/util/linked_list.py +113 -0
  193. whatap/util/linked_map.py +359 -0
  194. whatap/util/metering_util.py +103 -0
  195. whatap/util/request_double_queue.py +68 -0
  196. whatap/util/request_queue.py +60 -0
  197. whatap/util/string_util.py +20 -0
  198. whatap/util/throttle_util.py +99 -0
  199. whatap/util/userid_util.py +134 -0
  200. whatap/value/__init__.py +1 -0
  201. whatap/value/blob_value.py +38 -0
  202. whatap/value/boolean_value.py +33 -0
  203. whatap/value/decimal_value.py +36 -0
  204. whatap/value/double_summary.py +86 -0
  205. whatap/value/double_value.py +33 -0
  206. whatap/value/float_array.py +42 -0
  207. whatap/value/float_value.py +34 -0
  208. whatap/value/int_array.py +42 -0
  209. whatap/value/ip4_value.py +50 -0
  210. whatap/value/list_value.py +105 -0
  211. whatap/value/long_array.py +44 -0
  212. whatap/value/long_summary.py +83 -0
  213. whatap/value/map_value.py +154 -0
  214. whatap/value/null_value.py +21 -0
  215. whatap/value/number_value.py +33 -0
  216. whatap/value/summary_value.py +39 -0
  217. whatap/value/text_array.py +58 -0
  218. whatap/value/text_hash_value.py +37 -0
  219. whatap/value/text_value.py +43 -0
  220. whatap/value/value.py +26 -0
  221. whatap/value/value_enum.py +80 -0
  222. whatap/whatap.conf +14 -0
  223. whatap_python-2.1.0.dist-info/METADATA +87 -0
  224. whatap_python-2.1.0.dist-info/RECORD +227 -0
  225. whatap_python-2.1.0.dist-info/WHEEL +5 -0
  226. whatap_python-2.1.0.dist-info/entry_points.txt +6 -0
  227. whatap_python-2.1.0.dist-info/top_level.txt +1 -0
whatap/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from whatap import agent
2
+
3
+ if __name__ == '__main__':
4
+ agent()
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
@@ -0,0 +1,19 @@
1
+ import sys, os
2
+
3
+ try:
4
+ from whatap import agent
5
+ agent()
6
+ except ModuleNotFoundError:
7
+ pythonpath = os.environ.get('PYTHONPATH')
8
+ if pythonpath and os.path.basename(pythonpath) == "bootstrap":
9
+ pythonpath,_ = os.path.split(pythonpath)
10
+ pythonpath,_ = os.path.split(pythonpath)
11
+
12
+ sys.path.append(pythonpath)
13
+ try:
14
+ from whatap import agent
15
+ agent()
16
+ except ModuleNotFoundError:
17
+ #final fail
18
+ pass
19
+
whatap/build.py ADDED
@@ -0,0 +1,4 @@
1
+ app = 'Python'
2
+ name = 'whatap-python'
3
+ version = '2.1.0'
4
+ release_date = '20260610'
File without changes
@@ -0,0 +1,280 @@
1
+ Configuration = {
2
+ "dev": False,
3
+ "whatap_code_start": False,
4
+ "ignore_whatap_stdout" : False,
5
+ "apm_enabled": False,
6
+ "llm_enabled": False,
7
+ "net_udp_port": "6600",
8
+ "force_net_udp_port": False,
9
+ "web_static_content_extensions": "js, htm, html, gif, png, jpg, css, swf, ico",
10
+
11
+ "trace_auto_normalize_enabled": True,
12
+ "trace_user_enabled": True,
13
+ "trace_user_using_ip": True,
14
+ "trace_logging_enabled": False,
15
+ "trace_logging_mtid_enabled": False,
16
+ "trace_loguru_enabled": False,
17
+ "trace_loguru_mtid_enabled": False,
18
+ "trace_ignore_url_set": [],
19
+ "trace_ignore_url_prefix": None,
20
+ "trace_websocket_enabled": False,
21
+
22
+ # 자동 계측에서 제외할 라이브러리 목록(콤마 구분).
23
+ # - DEFINITION 키 전체: database.redis, llm.openai
24
+ # - 카테고리만: database (database.* 전부 스킵)
25
+ # - 라이브러리 이름만: redis, openai, django (해당 키만 스킵)
26
+ # 예: ignore_instrumentation_set=redis,openai,application.django
27
+ "ignore_instrumentation_set": [],
28
+
29
+ "llm_api_hosts": "",
30
+
31
+ "debug": False,
32
+ "query_string_enabled": False,
33
+ "query_string_urls": "",
34
+
35
+ "profile_dbc_close": False,
36
+ "profile_http_header_enabled": False,
37
+ "profile_http_parameter_enabled": False,
38
+ "profile_sql_param_enabled": False,
39
+ "hook_method_patterns": "",
40
+
41
+ "mtrace_rate": 10,
42
+ "mtrace_spec": '',
43
+ "mtrace_send_url_length": 80,
44
+
45
+ "_trace_mtrace_caller_key": "x-wtap-mst",
46
+ "_trace_mtrace_callee_key": "x-wtap-tx",
47
+ "_trace_mtrace_info_key": "x-wtap-sp1",
48
+ "_trace_mtrace_ip": "x-wtap-ip",
49
+ "_trace_mtrace_caller_poid_key": "x-wtap-po",
50
+
51
+ "stat_enabled": False,
52
+ "stat_domain_enabled": False,
53
+ "stat_domain_max_count": 7000,
54
+ "stat_mtrace_enabled": False,
55
+ "stat_mtrace_max_count": 7000,
56
+ "stat_login_enabled": False,
57
+ "stat_login_max_count": 7000,
58
+ "stat_referer_enabled": False,
59
+ "stat_referer_max_count": 7000,
60
+
61
+ "stat_tx_max_count": 5000,
62
+ "stat_sql_max_count": 5000,
63
+ "stat_httpc_max_count": 5000,
64
+ "stat_error_max_count": 1000,
65
+ "stat_useragent_max_count": 500,
66
+
67
+ "standalone_enabled" : False,
68
+ "standalone_type" : "single-transaction",
69
+ "standalone_transaction_patterns" : "",
70
+
71
+ "user_header_ticket_enabled": False,
72
+ "user_header_ticket":"",
73
+ "trace_user_cookie_limit":2048,
74
+ "trace_user_cookie_domain":"",
75
+ "profile_exception_stack": False,
76
+
77
+ # "whatap_server_host": "127.0.0.1/127.0.0.1",
78
+ # "whatap_server_port": 6600,
79
+ # "mode": "whatap_dev",
80
+ # "debug": False,
81
+ # "license": None,
82
+ # "counter_enabled": True,
83
+ # "stat_enabled": True,
84
+ # "active_stack_enabled": True,
85
+ # "trx_profile_enabled": True,
86
+ # "trx_profile_sql_enabled": True,
87
+ # "trx_profile_httpc_enabled": True,
88
+ # "trx_profile_max_time": 300000,
89
+ # "trx_profile_max_count": 10000,
90
+ # "prepared_sql_max": 5001,
91
+ # "debug_prepared_sql": False,
92
+ # "trace_service_name_header_key": None,
93
+ # "trace_service_name_key": None,
94
+ # "web_static_content_extensions": "js, htm, html, gif, png, jpg, css, txt",
95
+ # "trace_auto_service_enabled": False,
96
+ # "trace_auto_service_backstack_enabled": True,
97
+ # "trace_background_socket_enabled": True,
98
+ # "trace_activeserivce_yellow_time": 3000,
99
+ # "trace_activeservice_red_time": 8000,
100
+ # "trace_activeservice_hang_time": 6000,
101
+ # "trace_intertx_enabled": True,
102
+ # "trace_error_callstack_depth": 50,
103
+ # "trace_active_callstack_depth": 50,
104
+ # "_trace_intertx_caller_pcode_key": "x-wtap-pcode",
105
+ # "_trace_intertx_caller_oid_key": "x-wtap-oid",
106
+ # "_trace_intertx_caller_seq_key": "x-wtap-seq",
107
+ # "_trace_intertx_call_url_key": "x-wtap-url",
108
+ # "trace_httpc_normalize_urls": "",
109
+ # "trace_httpc_normalize_enabled": True,
110
+ # "trace_normalize_enabled": True,
111
+ # "log_ignore_set": None,
112
+ # "tcp_connection_timeout": 60000,
113
+ # "tcp_so_timeout": 60000,
114
+ # "net_send_max_bytes": 5 * 1024 * 1024,
115
+ # "net_send_queue1_size": 512,
116
+ # "net_send_queue2_size": 1024,
117
+ # "hook_connection_open_patterns": "",
118
+ # "log_datasource_lookup_enabled": True,
119
+ "throttle_enabled": False,
120
+ "throttle_blocking_url": '',
121
+ "throttle_blocking_ip": '',
122
+ "throttle_blocked_forward": '',
123
+ "throttle_blocked_message": 'request blocked!!',
124
+ "throttle_limit": None,
125
+ "throttle_target_urls": '',
126
+ "throttle_passing_url": '',
127
+ "throttle_passing_url_prefix": '',
128
+ "throttle_rejected_forward": '',
129
+ "throttle_rejected_message": "too many request!!",
130
+ "reject_event_enabled": False,
131
+ # "profile_http_querystring_enabled": False,
132
+ # "profile_http_header_enabled": False,
133
+ # "profile_http_parameter_enabled": False,
134
+ # "profile_http_parameter_url_prefix": "/",
135
+ # "profile_http_header_url_prefix": "/",
136
+ # "profile_connection_open_enabled": True,
137
+ # "profile_step_max_count": 1024,
138
+ # "hook_method_patterns": "",
139
+ # "hook_method_access_public_enabled": True,
140
+ # "hook_method_access_protected_enabled": True,
141
+ # "hook_method_access_private_enabled": False,
142
+ # "hook_method_access_none_enabled": True,
143
+ # "hook_method_ignore_prefixes": "get,set",
144
+ # "hook_method_ignore_classes": "",
145
+ # "profile_method_enabled": True,
146
+ # "hook_service_patterns": "",
147
+ # "hook_httpc_patterns": "",
148
+ # "hook_httpc_info_patterns": "",
149
+ # "hook_jdbc_pstmt_classes": "",
150
+ # "hook_jdbc_stmt_classes": "",
151
+ # "hook_jdbc_rs_classes": "",
152
+ # "hook_jdbc_wrapping_driver_patterns": "",
153
+ # "hook_context_classes": "javax/naming/InitialContext",
154
+ # "hook_jsp_patterns": "",
155
+ # "hook_trace_helper_start_patterns": "",
156
+ # "hook_trace_helper_end_patterns": "",
157
+ # "hook_dyna_ignore_count": 100,
158
+ #
159
+ # "profile_fullstack_max_lines": 0,
160
+ #
161
+ # "profile_step_normal_count": 800,
162
+ # "profile_step_heavy_count": 1000,
163
+ # "profile_step_max_count": 1024,
164
+ # "profile_step_heavy_time": 100,
165
+ #
166
+ # "boolean profile_sql_param_enabled": False,
167
+ # "profile_sql_resource_enabled": False,
168
+ # "profile_method_resource_enabled": False,
169
+ # "profile_httpc_resource_enabled": False,
170
+ # "_profile_prepare_sql": False,
171
+ # "profile_dbc_close": False,
172
+ #
173
+ "trace_http_client_ip_header_key": "",
174
+ # "trace_user_enabled": True,
175
+ # "trace_user_using_ip": False,
176
+ # "trace_user_using_type": 1,
177
+ # "trace_user_cookie_limit": 2048,
178
+ # "profile_error_jdbc_fetch_max": 10000,
179
+ # "profile_error_sql_time_max": 30000,
180
+ # "hook_direct_patch_classes": "",
181
+ # "_hook_serivce_enabled": True,
182
+ # "_hook_dbsql_enabled": True,
183
+ # "_hook_dbconn_enabled": True,
184
+ # "_hook_methods_enabled": True,
185
+ # "_hook_socket_enabled": True,
186
+ # "_hook_usertx_enabled": True,
187
+ # "log_rotation_enabled": True,
188
+ # "log_keep_days": 7,
189
+ # "thread_dump_enabled": False,
190
+ # "debug_cpu_enabled": False,
191
+ # "active_stack_always_do": False,
192
+ # "active_stack_callstack_interval_sec": 10,
193
+ # "realtime_interval_ms": 5000,
194
+ # "cipher_net_enabled": True,
195
+ # "cipher_level": 2,
196
+ # 'cypher_level': 128,
197
+ # "boot_redefine_size": 100,
198
+ # "counter_netstat_enabled": False,
199
+ # "counter_procfd_enabled": False,
200
+ # "counter_interval": 5000,
201
+ # "CONFIG_INITED": False,
202
+ # "_profile_position_httpc_hash": 0,
203
+ # "profile_position_httpc": "",
204
+ # "_profile_position_sql_hash": 0,
205
+ # "profile_position_sql": "",
206
+ # "_profile_position_method_hash": 0,
207
+ # "profile_position_method": "",
208
+ # "profile_position_depth": 50,
209
+ # "time_sync_interval_ms": 300000,
210
+ # "trace_active_transaction_yellow_time": 3000,
211
+ # "trace_active_transaction_red_time": 8000,
212
+ # "trace_active_transaction_hang_time": 30000,
213
+ # "realtime_user_thinktime_max": 300000,
214
+ # "service_port_enabled": False,
215
+ # 'log_pack_data': False,
216
+ # "active_stack_second": 10
217
+ "init_load_interval": 30000,
218
+ "session_read_timeout": 5000,
219
+ "reject_event_interval": 30000,
220
+ "master_agent_host" : "whatap-master-agent.whatap-monitoring.svc.cluster.local",
221
+ "master_agent_port" : 6600,
222
+ "unix_socket_enabled":False,
223
+ "unix_socket":"whatap.sock",
224
+ "debug_stack_enabled": False,
225
+ "log_unhandled_exception": 'false',
226
+ "threadstack_faulthandler": False,
227
+ "max_send_queue_size": 1000,
228
+ "open_file_descriptor_enabled": False,
229
+ "open_file_descriptor_interval":60,
230
+ "counter_thread_enabled": False,
231
+ "llm_net_udp_port": 6700,
232
+ "force_llm_net_udp_port": False,
233
+ "llm_model_pricing": "",
234
+ "llm_perf_sketch_enabled": True,
235
+ "llm_perf_sketch_k": 200,
236
+
237
+ # ── LLM Evaluation ──
238
+ # 평가 파이프라인 마스터 토글. false면 enqueue/worker가 동작하지 않음.
239
+ "llm_eval_enabled": False,
240
+ # judge LLM 호출 평가자의 샘플링 비율 (0.0 ~ 1.0).
241
+ # 1.0 (기본) — 모든 judge 평가자 항상 실행
242
+ # 0.1 — judge 평가자 10% 만 실행 (비용 1/10)
243
+ # 0.0 — judge 평가자 전부 skip
244
+ # 규칙 기반 평가자 (PIILeak / URLScan 등 USES_LLM_JUDGE=False) 는 영향 X.
245
+ # 결정론적 샘플링 — 같은 txid 는 항상 같은 결정.
246
+ "llm_eval_sample_rate": 1.0,
247
+ # 평가 큐 최대 크기. 초과 시 drop + LLM030 경고.
248
+ "llm_eval_buffer_limit": 1000,
249
+ # 평가자 실행에 쓸 ThreadPoolExecutor worker 수.
250
+ "llm_eval_workers": 4,
251
+ # judge LLM 1회 호출의 최대 대기 시간 (초). 초과 시 TimeoutError → judge_error
252
+ # 로 graceful degrade. user app 의 event loop 가 hang/backpressure 일 때
253
+ # 평가 워커가 무기한 블록되는 것을 차단. 0 또는 음수면 무제한 (legacy 동작).
254
+ "llm_eval_judge_timeout_sec": 30,
255
+ # judge LLM 호출도 기존 인스트루멘테이션 (intercept) 으로 추적할지 여부.
256
+ # False (기본): judge 호출은 intercept 우회 → 메트릭/logsink 에 안 잡힘.
257
+ # (eval 결과 점수만 LlmStepEvalStatus + llm_eval_stat 로 송출)
258
+ # True : judge 호출이 llm_step_status pack + 메트릭에 잡힘 (사용자 호출과 동일).
259
+ # cost/token/latency 가시화. 메트릭 카운트 2배 증가 가능 (user + judge).
260
+ "llm_eval_track_judge_calls": False,
261
+ # 활성 평가자 csv. 미지정 (빈 값) 이면 default 3 종 자동 활성:
262
+ # combined_judge, pii_leak, url_scan
263
+ # 개별 aspect evaluator (hallucination / answer_relevance / toxicity /
264
+ # prompt_injection / factuality) 는 combined_judge 가 1회 judge 호출로 이미
265
+ # 모두 산출하므로 default 에서 제외 — 명시 활성 시에만 별도 evaluator 가 추가
266
+ # judge 호출을 발생시킴.
267
+ #
268
+ # 가용 라벨 (각 라벨이 evaluator 1개 + 동명 stat 카테고리에 매핑):
269
+ # combined_judge — 1번의 LLM judge 호출로 5 의미 aspect 동시 평가
270
+ # (hallucination / answer_relevance / toxicity /
271
+ # prompt_injection / factuality)
272
+ # pii_leak — 정규식 + Luhn 으로 PII 노출 탐지 (LLM 호출 X)
273
+ # url_scan — URL 추출 + suspicious 패턴 매칭 (LLM 호출 X)
274
+ # hallucination / answer_relevance / toxicity / prompt_injection / factuality
275
+ # — combined_judge 대신 개별 evaluator 만 쓰고 싶을 때
276
+ # 예: "combined_judge,pii_leak,url_scan" (default 와 동일)
277
+ # 예: "pii_leak,url_scan" (정형 평가만, LLM judge 0회)
278
+ # 예: "hallucination,toxicity,pii_leak" (개별 aspect — combined 대신)
279
+ "llm_eval_evaluators": "",
280
+ }
@@ -0,0 +1,105 @@
1
+ import os, time
2
+
3
+ from whatap.conf.configuration import Configuration
4
+
5
+
6
+ class Configure(object):
7
+ PCODE = 0
8
+ OID = 0
9
+ OKIND = 0
10
+ OKIND_NAME = os.environ.get("ENV_OKIND", "-".join(os.environ.get("POD_NAME", "").split("-")[0:-1]))
11
+ dev = False
12
+ net_udp_port = 6600
13
+ force_net_udp_port = False
14
+ last_loaded = 0
15
+ last_config_modified = 0
16
+ observers = []
17
+ POD_NAME = os.environ.get("POD_NAME") if os.environ.get('POD_NAME') else os.environ.get("PODNAME") if os.environ.get("PODNAME") else ''
18
+ license = None
19
+ max_send_queue_size = 2000
20
+
21
+ @classmethod
22
+ def init(cls, display=True):
23
+ if cls.last_loaded == 0:
24
+ cls.loadFromEnv()
25
+ cls.last_loaded = time.time()
26
+ return cls.load(display)
27
+
28
+ @classmethod
29
+ def loadFromEnv(cls):
30
+ for key, value in Configuration.items():
31
+ setattr(cls, key, value)
32
+ if not hasattr(cls, "license") and hasattr(cls, "accesskey"):
33
+ setattr(cls, "license", getattr(cls, "accesskey"))
34
+
35
+ @classmethod
36
+ def load(cls, display=True):
37
+ home = 'WHATAP_HOME'
38
+ try:
39
+ whatap_config = os.path.join(os.environ[home],os.environ['WHATAP_CONFIG'])
40
+ last_modified = os.path.getmtime(whatap_config)
41
+ if cls.last_config_modified >= last_modified:
42
+ return True
43
+ for key, value in os.environ.items():
44
+ setattr(cls, key, value)
45
+
46
+ with open(whatap_config, 'r') as f:
47
+ for line in f:
48
+ cls.last_config_modified = last_modified
49
+ line_strip = line.strip()
50
+ if not line_strip or line_strip.startswith('#'):
51
+ continue
52
+ try:
53
+ key, value = line.split('=')
54
+ key = key.strip()
55
+ value = value.strip()
56
+ if key and key.endswith("_set"):
57
+ value = value.split(",")
58
+ cls.setProperty(key, value)
59
+
60
+ except Exception as e:
61
+ print('WHATAP: ', e)
62
+ continue
63
+ if not getattr(cls, "license", None) and getattr(cls, "accesskey", None):
64
+ setattr(cls, "license", getattr(cls, "accesskey"))
65
+ for callback in cls.observers:
66
+ callback()
67
+ except Exception as e:
68
+ from whatap import CONFIG_FILE_NAME, init_config
69
+ init_config(home)
70
+ return False
71
+ else:
72
+ return True
73
+ finally:
74
+ if display:
75
+ from whatap import Logger
76
+ Logger()
77
+
78
+ @classmethod
79
+ def getProperty(cls, key, value=None):
80
+ if hasattr(cls, key):
81
+ return getattr(cls, key)
82
+ elif key in os.environ:
83
+ return os.environ[key]
84
+ else:
85
+ return value
86
+
87
+ @classmethod
88
+ def setProperty(cls, name, value):
89
+ if hasattr(cls, name):
90
+ if isinstance(getattr(cls, name), bool) and str(value) != 'true':
91
+ value = False
92
+
93
+ setattr(cls, name, value)
94
+
95
+ def getStringSet(cls, key, default_value, deli):
96
+ l = list()
97
+ value = cls.getProperty(key, default_value)
98
+ if value:
99
+ for v in value.split(deli):
100
+ l.append(v)
101
+ return l
102
+
103
+ @classmethod
104
+ def addObserver(cls, callback):
105
+ cls.observers.append(callback)
whatap/conf/license.py ADDED
@@ -0,0 +1,49 @@
1
+ import io
2
+
3
+ from whatap.io.data_inputx import DataInputX
4
+ from whatap.io.data_outputx import DataOutputX
5
+
6
+ from whatap.util.hexa32 import Hexa32
7
+
8
+
9
+ class Key(object):
10
+ def __init__(self):
11
+ self.pcode = None
12
+ self.security_key = io.BytesIO()
13
+
14
+ def __repr__(self):
15
+ to_str = '{0}: '.format(type(self).__name__)
16
+
17
+ res = []
18
+ for key, value in self.__dict__.items():
19
+ if type(value).__name__.find('bytes') > -1:
20
+ dout = DataOutputX()
21
+ dout.writeIntBytes(value)
22
+
23
+ if isinstance(value, bytes) or isinstance(value, bytearray):
24
+ for o in value:
25
+ if o > 128:
26
+ o -= 256
27
+ res.append(o)
28
+
29
+ to_str += '{0}={1}, '.format(key, res)
30
+ return to_str
31
+
32
+
33
+ class License(object):
34
+ @staticmethod
35
+ def getKey(lic):
36
+ tokens = lic.split('-')
37
+ dout = DataOutputX(len(tokens) * 8)
38
+ for token in tokens:
39
+ dout.writeLong(Hexa32.toLong32(token))
40
+ key = Key()
41
+ din = DataInputX(dout.toByteArray())
42
+ key.pcode = din.readDecimal()
43
+ key.security_key = din.readBlob()
44
+ return key
45
+
46
+ @staticmethod
47
+ def getProjectCode(lic):
48
+ k = License.getKey(lic)
49
+ return k.pcode
File without changes
@@ -0,0 +1,14 @@
1
+ from .counter_manager import CounterMgr #CounterMgr 클래스 import
2
+ from whatap import preview_whatap_conf
3
+
4
+ counter_thread_enabled = preview_whatap_conf("counter_thread_enabled")
5
+
6
+ if counter_thread_enabled != 'false':
7
+ mgr = CounterMgr()
8
+ mgr.setDaemon(True)
9
+ mgr.start()
10
+
11
+ from .tasks.llm_stat_task import LlmStatTask
12
+ llm_stat = LlmStatTask()
13
+ llm_stat.setDaemon(True)
14
+ llm_stat.start()
@@ -0,0 +1,45 @@
1
+ import time
2
+ import logging
3
+ from threading import Thread
4
+
5
+
6
+ class CounterMgr(Thread):
7
+ _instance = None
8
+
9
+ def __init__(self):
10
+ super(CounterMgr, self).__init__()
11
+ self.tasks = list()
12
+ self._task_map = {}
13
+ self.last_executed = {}
14
+ CounterMgr._instance = self
15
+
16
+ def _register_tasks(self):
17
+ from .tasks import TASK_CLASSES
18
+ for cls in TASK_CLASSES:
19
+ task = cls()
20
+ self.tasks.append(task)
21
+ self._task_map[task.name()] = task
22
+ self.last_executed[task.name()] = 0
23
+
24
+ def run(self):
25
+ self._register_tasks()
26
+
27
+ while True:
28
+ current_time = time.time()
29
+ time.sleep(1)
30
+ for task in self.tasks:
31
+ last_executed_time = self.last_executed[task.name()]
32
+ interval = task.interval()
33
+
34
+ if current_time - last_executed_time >= interval:
35
+ try:
36
+ self.last_executed[task.name()] = current_time
37
+ task.process()
38
+ except Exception as e:
39
+ logging.debug(e, extra={'id': 'WA181'}, exc_info=True)
40
+
41
+ @classmethod
42
+ def get_task(cls, name):
43
+ if cls._instance is None:
44
+ return None
45
+ return cls._instance._task_map.get(name)
@@ -0,0 +1,3 @@
1
+ from whatap.counter.tasks.openfiledescriptor import OpenFileDescriptorTask
2
+
3
+ TASK_CLASSES = [OpenFileDescriptorTask]
@@ -0,0 +1,26 @@
1
+ import whatap.net.async_sender as async_sender
2
+ import whatap.io as whatapio
3
+
4
+
5
+ class BaseTask(object):
6
+ _llm_task = False
7
+
8
+ def name(self):
9
+ return self.__class__.__name__
10
+
11
+ def interval(self):
12
+ return 60
13
+
14
+ def process(self):
15
+ pass
16
+
17
+ def send_pack(self, pack):
18
+ from whatap.conf.configure import Configure as conf
19
+ pack.pcode = getattr(conf, 'PCODE', 0)
20
+ bout = whatapio.DataOutputX()
21
+ bout.writePack(pack, None)
22
+ packbytes = bout.toByteArray()
23
+ if self._llm_task:
24
+ async_sender.send_llm_relaypack(packbytes)
25
+ else:
26
+ async_sender.send_relaypack(packbytes)