whatap-python 1.7.1__tar.gz → 1.7.2__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.1 → whatap_python-1.7.2}/PKG-INFO +1 -1
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/__init__.py +2 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/agent/linux/amd64/whatap_python +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/agent/linux/arm64/whatap_python +0 -0
- whatap_python-1.7.2/whatap/build.py +4 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/conf/configuration.py +2 -0
- whatap_python-1.7.2/whatap/counter/__init__.py +6 -0
- whatap_python-1.7.2/whatap/counter/counter_manager.py +36 -0
- whatap_python-1.7.2/whatap/counter/tasks/openfiledescriptor.py +57 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/pack/pack_enum.py +1 -1
- whatap_python-1.7.2/whatap/pack/tagCountPack.py +61 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_wsgi.py +26 -15
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_mongo.py +1 -2
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_redis.py +3 -4
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_toolkit.py +1 -1
- whatap_python-1.7.2/whatap/util/cardinality/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/map_value.py +22 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/PKG-INFO +1 -1
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/SOURCES.txt +5 -0
- whatap_python-1.7.1/whatap/build.py +0 -4
- {whatap_python-1.7.1 → whatap_python-1.7.2}/README.md +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/setup.cfg +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/setup.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/LICENSE +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/README.rst +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/__main__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/agent/darwin/amd64/whatap_python +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/agent/darwin/arm64/whatap_python +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/bootstrap/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/bootstrap/sitecustomize.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/conf/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/conf/configure.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/conf/license.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/control/__init__.py +0 -0
- {whatap_python-1.7.1/whatap/net → whatap_python-1.7.2/whatap/counter/tasks}/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/io/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/io/data_inputx.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/io/data_outputx.py +0 -0
- {whatap_python-1.7.1/whatap/pack → whatap_python-1.7.2/whatap/net}/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/async_sender.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/packet_enum.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/packet_type_enum.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/param_def.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/stackhelper.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/udp_session.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/net/udp_thread.py +0 -0
- {whatap_python-1.7.1/whatap/trace/mod → whatap_python-1.7.2/whatap/pack}/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/pack/logSinkPack.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/pack/pack.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/scripts/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/__init__.py +0 -0
- {whatap_python-1.7.1/whatap/util → whatap_python-1.7.2/whatap/trace/mod}/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/amqp_kombu.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/amqp_pika.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_bottle.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_celery.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_cherrypy.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_django.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_django_asgi.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_django_py3.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_fastapi.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_flask.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_frappe.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_graphql.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_nameko.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/application_tornado.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_cxoracle.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_mysql.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/database_postgresql.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/email_smtp.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/httpc_django.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/httpc_httplib.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/httpc_requests.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/httpc_urllib3.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/logging.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/mod/plugin.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/simple_trace_context.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/trace_context.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/trace_context_manager.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/trace_import.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/trace/trace_module_definition.py +0 -0
- {whatap_python-1.7.1/whatap/util/cardinality → whatap_python-1.7.2/whatap/util}/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/bit_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/cardinality/hyperloglog.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/cardinality/murmurhash.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/cardinality/registerset.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/compare_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/date_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/debug_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/escape_literal_sql.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/hash_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/hexa32.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/int_set.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/ip_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/keygen.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/linked_list.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/linked_map.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/metering_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/request_double_queue.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/request_queue.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/string_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/throttle_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/util/userid_util.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/__init__.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/blob_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/boolean_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/decimal_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/double_summary.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/double_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/float_array.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/float_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/int_array.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/ip4_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/list_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/long_array.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/long_summary.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/null_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/number_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/summary_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/text_array.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/text_hash_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/text_value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/value.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/value/value_enum.py +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap/whatap.conf +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/dependency_links.txt +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/entry_points.txt +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/not-zip-safe +0 -0
- {whatap_python-1.7.1 → whatap_python-1.7.2}/whatap_python.egg-info/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
import logging
|
|
4
|
+
from threading import Thread
|
|
5
|
+
from .tasks.openfiledescriptor import OpenFileDescriptorTask
|
|
6
|
+
|
|
7
|
+
#현재 디렉토리 아래 tasks 가 있고 그안의 openfiledescriptor.py 파일에 OpenFileDescriptorTask 클래스를 import 하고싶어.
|
|
8
|
+
|
|
9
|
+
class CounterMgr(Thread):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super(CounterMgr, self).__init__() # Thread 초기화
|
|
12
|
+
self.tasks = list()
|
|
13
|
+
self.last_executed = {} # 각 task의 마지막 실행 시간을 기록하기 위한 딕셔너리
|
|
14
|
+
|
|
15
|
+
def run(self):
|
|
16
|
+
# OpenFileDescriptorTask 인스턴스 생성 후 tasks에 추가
|
|
17
|
+
task = OpenFileDescriptorTask()
|
|
18
|
+
self.tasks.append(task)
|
|
19
|
+
self.last_executed[task.name()] = 0 # 각 task의 마지막 실행 시간을 초기화
|
|
20
|
+
while True:
|
|
21
|
+
current_time = time.time() # 현재 시간을 초 단위로 가져옴
|
|
22
|
+
time.sleep(1) # 0.1초마다 확인 (부하 줄이기)
|
|
23
|
+
for task in self.tasks:
|
|
24
|
+
|
|
25
|
+
# 현재 시간과 마지막 실행 시간을 비교하여 task.interval() 초 만큼의 시간이 지났으면 실행
|
|
26
|
+
last_executed_time = self.last_executed[task.name()]
|
|
27
|
+
interval = task.interval()
|
|
28
|
+
|
|
29
|
+
if current_time - last_executed_time >= interval:
|
|
30
|
+
try:
|
|
31
|
+
self.last_executed[task.name()] = current_time # 마지막 실행 시간 업데이트
|
|
32
|
+
task.process() # task 실행
|
|
33
|
+
|
|
34
|
+
except Exception as e:
|
|
35
|
+
logging.debug(e, extra={'id': 'WA181'}, exc_info=True)
|
|
36
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import whatap.net.async_sender as async_sender
|
|
2
|
+
from whatap.pack import tagCountPack
|
|
3
|
+
from whatap import DateUtil, conf
|
|
4
|
+
import whatap.io as whatapio
|
|
5
|
+
import os, resource
|
|
6
|
+
|
|
7
|
+
currentpid = os.getpid()
|
|
8
|
+
|
|
9
|
+
soft_limit, _= resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
10
|
+
|
|
11
|
+
class OpenFileDescriptorTask:
|
|
12
|
+
def name(self):
|
|
13
|
+
|
|
14
|
+
return "OpenFileDescriptorTask"
|
|
15
|
+
|
|
16
|
+
def interval(self):
|
|
17
|
+
from whatap.conf.configure import Configure as conf
|
|
18
|
+
return conf.open_file_descriptor_interval
|
|
19
|
+
|
|
20
|
+
def process(self):
|
|
21
|
+
from whatap.conf.configure import Configure as conf
|
|
22
|
+
if not conf.open_file_descriptor_enabled:
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
currentnofile = self.currentNofile()
|
|
26
|
+
if soft_limit:
|
|
27
|
+
current_nofile_pct = float(currentnofile) / float(soft_limit) * float(100)
|
|
28
|
+
else:
|
|
29
|
+
current_nofile_pct = "N/A"
|
|
30
|
+
category = "app_filedescriptor"
|
|
31
|
+
tags = dict(pid=currentpid)
|
|
32
|
+
fields = dict(max_nofile = soft_limit,
|
|
33
|
+
currnet_nofile=currentnofile,
|
|
34
|
+
current_nofile_pct=current_nofile_pct )
|
|
35
|
+
|
|
36
|
+
p = tagCountPack.getTagCountPack(
|
|
37
|
+
t=DateUtil.now(),
|
|
38
|
+
category=f"{category}",
|
|
39
|
+
tags=tags,
|
|
40
|
+
fields=fields
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
p.pcode = conf.PCODE
|
|
44
|
+
bout = whatapio.DataOutputX()
|
|
45
|
+
bout.writePack(p, None)
|
|
46
|
+
packbytes = bout.toByteArray()
|
|
47
|
+
|
|
48
|
+
async_sender.send_relaypack(packbytes)
|
|
49
|
+
|
|
50
|
+
def currentNofile(self):
|
|
51
|
+
fd_directory = f'/proc/{currentpid}/fd' # 현재 프로세스의 파일 디스크립터가 있는 디렉터리
|
|
52
|
+
try:
|
|
53
|
+
fd_count = len(os.listdir(fd_directory)) # fd 디렉터리 안의 파일 목록 개수
|
|
54
|
+
return fd_count
|
|
55
|
+
except FileNotFoundError:
|
|
56
|
+
#print("이 시스템에서는 /proc 파일 시스템이 지원되지 않습니다.")
|
|
57
|
+
return "N/A"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from whatap.pack.pack import Pack
|
|
2
|
+
from whatap.pack.pack_enum import PackEnum
|
|
3
|
+
from whatap.value.map_value import MapValue
|
|
4
|
+
from whatap.io.data_outputx import DataOutputX
|
|
5
|
+
from whatap.util.hash_util import HashUtil as hashutil
|
|
6
|
+
|
|
7
|
+
class TagCountPack(Pack):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super(TagCountPack, self).__init__()
|
|
10
|
+
self.tagHash = 0 # int64
|
|
11
|
+
self.tags = MapValue()
|
|
12
|
+
self.fields = MapValue()
|
|
13
|
+
|
|
14
|
+
def getPackType(self):
|
|
15
|
+
return PackEnum.TAG_COUNT
|
|
16
|
+
|
|
17
|
+
def write(self, dout):
|
|
18
|
+
super(TagCountPack, self).write(dout)
|
|
19
|
+
|
|
20
|
+
dout.writeByte(0)
|
|
21
|
+
dout.writeText(self.Category)
|
|
22
|
+
if self.tagHash == 0 and self.tags.size() > 0:
|
|
23
|
+
tagHash, tagBytes = self.resetTagHash()
|
|
24
|
+
self.tagHash = tagHash
|
|
25
|
+
dout.writeDecimal(tagHash)
|
|
26
|
+
dout.write(tagBytes)
|
|
27
|
+
else:
|
|
28
|
+
dout.writeDecimal(self.tagHash)
|
|
29
|
+
dout.writeValue(self.tags)
|
|
30
|
+
dout.writeValue(self.fields)
|
|
31
|
+
|
|
32
|
+
def resetTagHash(self) :
|
|
33
|
+
dout = DataOutputX()
|
|
34
|
+
dout.writeValue(self.tags)
|
|
35
|
+
tagBytes = dout.toByteArray()
|
|
36
|
+
tagHash = hashutil.hash(tagBytes)
|
|
37
|
+
return tagHash, tagBytes
|
|
38
|
+
|
|
39
|
+
def read(self, din):
|
|
40
|
+
super(TagCountPack, self).read(din)
|
|
41
|
+
din.readByte()
|
|
42
|
+
self.Category = din.readText()
|
|
43
|
+
self.tagHash = din.ReadDecimal()
|
|
44
|
+
self.tags = din.readValue()
|
|
45
|
+
self.fields = din.readValue()
|
|
46
|
+
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
def getTagCountPack( t = 0,
|
|
50
|
+
category = None,
|
|
51
|
+
tags = {},
|
|
52
|
+
fields = {}):
|
|
53
|
+
pack = TagCountPack()
|
|
54
|
+
pack.time = t
|
|
55
|
+
pack.Category = category
|
|
56
|
+
for k, v in tags.items():
|
|
57
|
+
pack.tags.putAuto(k, v)
|
|
58
|
+
for k, v in fields.items():
|
|
59
|
+
pack.fields.putAuto(k, v)
|
|
60
|
+
return pack
|
|
61
|
+
|
|
@@ -307,8 +307,12 @@ def interceptor_step_error(e, ctx=None):
|
|
|
307
307
|
def interceptor_httpc_request(fn, httpc_url, *args, **kwargs):
|
|
308
308
|
ctx = TraceContextManager.getLocalContext()
|
|
309
309
|
if not ctx or ctx.active_httpc_hash:
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
try:
|
|
311
|
+
return fn(*args, **kwargs)
|
|
312
|
+
except Exception as e:
|
|
313
|
+
interceptor_step_error(e, ctx=ctx)
|
|
314
|
+
finally:
|
|
315
|
+
return
|
|
312
316
|
param = None
|
|
313
317
|
method = None
|
|
314
318
|
if httpc_url.find('?') > -1:
|
|
@@ -365,7 +369,7 @@ def interceptor_sock_connect(fn, *args, **kwargs):
|
|
|
365
369
|
|
|
366
370
|
def interceptor_db_con(fn, db_type, *args, **kwargs):
|
|
367
371
|
ctx = TraceContextManager.getLocalContext()
|
|
368
|
-
if ctx
|
|
372
|
+
if not ctx:
|
|
369
373
|
return fn(*args, **kwargs)
|
|
370
374
|
|
|
371
375
|
start_time = DateUtil.nowSystem()
|
|
@@ -443,7 +447,7 @@ def interceptor_db_execute(fn, *args, **kwargs):
|
|
|
443
447
|
except Exception as e:
|
|
444
448
|
query = args[1]
|
|
445
449
|
|
|
446
|
-
if not query
|
|
450
|
+
if not query:
|
|
447
451
|
return fn(*args, **kwargs)
|
|
448
452
|
|
|
449
453
|
start_time = DateUtil.nowSystem()
|
|
@@ -474,19 +478,26 @@ def interceptor_db_close(fn, *args, **kwargs):
|
|
|
474
478
|
ctx.db_opening = False
|
|
475
479
|
|
|
476
480
|
if not conf.profile_dbc_close:
|
|
477
|
-
|
|
478
|
-
|
|
481
|
+
try:
|
|
482
|
+
return fn(*args, **kwargs)
|
|
483
|
+
except Exception as e:
|
|
484
|
+
interceptor_step_error(e)
|
|
485
|
+
finally:
|
|
486
|
+
return
|
|
479
487
|
start_time = DateUtil.nowSystem()
|
|
480
488
|
ctx.start_time = start_time
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
489
|
+
|
|
490
|
+
try:
|
|
491
|
+
callback = fn(*args, **kwargs)
|
|
492
|
+
return callback
|
|
493
|
+
except Exception as e:
|
|
494
|
+
interceptor_step_error(e)
|
|
495
|
+
finally:
|
|
496
|
+
text = 'DB: Close Connection.'
|
|
497
|
+
datas = [' ', ' ', text]
|
|
498
|
+
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
499
|
+
async_sender.send_packet(PacketTypeEnum.TX_MSG, ctx, datas)
|
|
500
|
+
|
|
490
501
|
|
|
491
502
|
check_seq = 1
|
|
492
503
|
|
|
@@ -26,7 +26,7 @@ class WhatapMongoCmdEventListener(pymongo.monitoring.CommandListener):
|
|
|
26
26
|
|
|
27
27
|
def __started(self, event):
|
|
28
28
|
ctx = TraceContextManager.getLocalContext()
|
|
29
|
-
if not ctx
|
|
29
|
+
if not ctx:
|
|
30
30
|
return
|
|
31
31
|
start_time = DateUtil.nowSystem()
|
|
32
32
|
ctx.start_time = start_time
|
|
@@ -49,7 +49,6 @@ class WhatapMongoCmdEventListener(pymongo.monitoring.CommandListener):
|
|
|
49
49
|
|
|
50
50
|
start_time = DateUtil.nowSystem()
|
|
51
51
|
ctx.start_time = start_time
|
|
52
|
-
ctx.active_sqlhash = command
|
|
53
52
|
|
|
54
53
|
def succeeded(self, event):
|
|
55
54
|
try:
|
|
@@ -9,7 +9,8 @@ import numbers
|
|
|
9
9
|
|
|
10
10
|
def intercept_send_command(fn, instance, *args, **kwargs):
|
|
11
11
|
ctx = TraceContextManager.getLocalContext()
|
|
12
|
-
if ctx
|
|
12
|
+
if not ctx:
|
|
13
|
+
|
|
13
14
|
return fn(instance, *args, **kwargs)
|
|
14
15
|
start_time = DateUtil.nowSystem()
|
|
15
16
|
ctx.start_time = start_time
|
|
@@ -29,9 +30,7 @@ def intercept_send_command(fn, instance, *args, **kwargs):
|
|
|
29
30
|
ctx.elapsed = DateUtil.nowSystem() - start_time
|
|
30
31
|
async_sender.send_packet(PacketTypeEnum.TX_DB_CONN, ctx, datas)
|
|
31
32
|
query = " ".join([ str(arg)[:20] for arg in args])
|
|
32
|
-
|
|
33
|
-
return fn(instance, *args, **kwargs)
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
start_time = DateUtil.nowSystem()
|
|
36
35
|
ctx.start_time = start_time
|
|
37
36
|
ctx.active_sqlhash = query
|
|
@@ -68,7 +68,7 @@ def instrument_sqlalchemy_engine(module):
|
|
|
68
68
|
except Exception as e:
|
|
69
69
|
query = str(args[2])
|
|
70
70
|
# print('instrument_sqlalchemy_engine 3:', query)
|
|
71
|
-
if not query
|
|
71
|
+
if not query :
|
|
72
72
|
return fn(*args, **kwargs)
|
|
73
73
|
|
|
74
74
|
start_time = DateUtil.nowSystem()
|
|
File without changes
|
|
@@ -2,6 +2,7 @@ from whatap.value.boolean_value import BooleanValue
|
|
|
2
2
|
from whatap.value.decimal_value import DecimalValue
|
|
3
3
|
from whatap.value.number_value import NumberValue
|
|
4
4
|
from whatap.value.text_value import TextValue
|
|
5
|
+
from whatap.value.float_value import FloatValue
|
|
5
6
|
from whatap.value.value import Value
|
|
6
7
|
from whatap.value.value_enum import ValueEnum
|
|
7
8
|
|
|
@@ -75,6 +76,27 @@ class MapValue(Value):
|
|
|
75
76
|
self.table[key] = value
|
|
76
77
|
return self
|
|
77
78
|
|
|
79
|
+
def putAuto(self, key, value):
|
|
80
|
+
# key가 string이 아닐 경우, 경고 메시지를 출력하고 아무 것도 하지 않음
|
|
81
|
+
if not isinstance(key, str):
|
|
82
|
+
#print("키는 문자열이어야 합니다.")
|
|
83
|
+
return self
|
|
84
|
+
|
|
85
|
+
# value의 타입에 따라 적절하게 감싸기
|
|
86
|
+
if isinstance(value, int):
|
|
87
|
+
wrapped_value = DecimalValue(value)
|
|
88
|
+
elif isinstance(value, float):
|
|
89
|
+
wrapped_value = FloatValue(value)
|
|
90
|
+
elif isinstance(value, (str)):
|
|
91
|
+
wrapped_value = TextValue(value)
|
|
92
|
+
else:
|
|
93
|
+
#print("지원하지 않는 값 타입입니다.")
|
|
94
|
+
return self
|
|
95
|
+
|
|
96
|
+
# key-value 쌍을 저장
|
|
97
|
+
self.table[key] = wrapped_value
|
|
98
|
+
return self
|
|
99
|
+
|
|
78
100
|
def putValue(self, key, value):
|
|
79
101
|
self.table[key] = value
|
|
80
102
|
return self
|
|
@@ -18,6 +18,10 @@ whatap/conf/configuration.py
|
|
|
18
18
|
whatap/conf/configure.py
|
|
19
19
|
whatap/conf/license.py
|
|
20
20
|
whatap/control/__init__.py
|
|
21
|
+
whatap/counter/__init__.py
|
|
22
|
+
whatap/counter/counter_manager.py
|
|
23
|
+
whatap/counter/tasks/__init__.py
|
|
24
|
+
whatap/counter/tasks/openfiledescriptor.py
|
|
21
25
|
whatap/io/__init__.py
|
|
22
26
|
whatap/io/data_inputx.py
|
|
23
27
|
whatap/io/data_outputx.py
|
|
@@ -33,6 +37,7 @@ whatap/pack/__init__.py
|
|
|
33
37
|
whatap/pack/logSinkPack.py
|
|
34
38
|
whatap/pack/pack.py
|
|
35
39
|
whatap/pack/pack_enum.py
|
|
40
|
+
whatap/pack/tagCountPack.py
|
|
36
41
|
whatap/scripts/__init__.py
|
|
37
42
|
whatap/trace/__init__.py
|
|
38
43
|
whatap/trace/simple_trace_context.py
|
|
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
|