locust-cloud 1.5.0__py3-none-any.whl → 1.5.1__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.
- locust_cloud/timescale/query.py +9 -19
- {locust_cloud-1.5.0.dist-info → locust_cloud-1.5.1.dist-info}/METADATA +1 -1
- {locust_cloud-1.5.0.dist-info → locust_cloud-1.5.1.dist-info}/RECORD +5 -5
- {locust_cloud-1.5.0.dist-info → locust_cloud-1.5.1.dist-info}/WHEEL +0 -0
- {locust_cloud-1.5.0.dist-info → locust_cloud-1.5.1.dist-info}/entry_points.txt +0 -0
locust_cloud/timescale/query.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import json
|
2
1
|
import logging
|
3
|
-
import time
|
4
2
|
|
5
3
|
from flask import make_response, request
|
6
4
|
from locust_cloud.timescale.queries import queries
|
@@ -15,20 +13,18 @@ def adapt_timestamp(result):
|
|
15
13
|
def register_query(environment, pool):
|
16
14
|
@environment.web_ui.app.route("/cloud-stats/<query>", methods=["POST"])
|
17
15
|
def query(query):
|
18
|
-
print(query)
|
19
16
|
results = []
|
20
|
-
|
21
17
|
try:
|
22
18
|
if query and queries[query]:
|
23
|
-
start_time = time.perf_counter()
|
19
|
+
# start_time = time.perf_counter()
|
24
20
|
with pool.connection() as conn:
|
25
|
-
get_conn_time = (time.perf_counter() - start_time) * 1000
|
21
|
+
# get_conn_time = (time.perf_counter() - start_time) * 1000
|
26
22
|
sql_params = request.get_json()
|
27
|
-
start_time = time.perf_counter()
|
23
|
+
# start_time = time.perf_counter()
|
28
24
|
cursor = conn.execute(queries[query], sql_params)
|
29
|
-
exec_time = (time.perf_counter() - start_time) * 1000
|
25
|
+
# exec_time = (time.perf_counter() - start_time) * 1000
|
30
26
|
assert cursor
|
31
|
-
start_time = time.perf_counter()
|
27
|
+
# start_time = time.perf_counter()
|
32
28
|
results = [
|
33
29
|
adapt_timestamp(
|
34
30
|
dict(
|
@@ -40,16 +36,10 @@ def register_query(environment, pool):
|
|
40
36
|
)
|
41
37
|
for row in cursor.fetchall()
|
42
38
|
]
|
43
|
-
fetch_time = (time.perf_counter() - start_time) * 1000
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
)
|
48
|
-
try:
|
49
|
-
json.dumps(results)
|
50
|
-
except TypeError:
|
51
|
-
logger.error(f"Could not serialize result: {str(results)[:500]}")
|
52
|
-
return make_response(f"Could not serialize result: {str(results)[:500]}", 400)
|
39
|
+
# fetch_time = (time.perf_counter() - start_time) * 1000
|
40
|
+
# logger.info(
|
41
|
+
# f"Executed query '{query}' with params {sql_params}. It took {round(get_conn_time)}+{round(exec_time)}+{round(fetch_time)}ms"
|
42
|
+
# )
|
53
43
|
return results
|
54
44
|
else:
|
55
45
|
logger.warning(f"Received invalid query key: '{query}'")
|
@@ -5,7 +5,7 @@ locust_cloud/constants.py,sha256=YGgIEnaOT9cAA8F8a8Z8lOmlI78D2fXiVpP0RF213MA,167
|
|
5
5
|
locust_cloud/credential_manager.py,sha256=JbuS22RTGAmngVB9DFLxHIgaonCSImemMGvtWnxBZRE,5515
|
6
6
|
locust_cloud/timescale/exporter.py,sha256=iojCxuV9H9yg5O9y3lDdXUq0gOgklUD6JOfV2Pe8hXU,10808
|
7
7
|
locust_cloud/timescale/queries.py,sha256=TjcmWDB9PZSslnKLbUs3o6R9NZ61zV3BSu36XKNensk,5863
|
8
|
-
locust_cloud/timescale/query.py,sha256=
|
8
|
+
locust_cloud/timescale/query.py,sha256=Ab3tAZSAeAH2SPBhreVxCNOiVbpq_eKb5xMiCrlsRwk,2078
|
9
9
|
locust_cloud/webui/.eslintrc,sha256=huuuTZNwbBGkhfelEOMhLQ-tgC9OYnnX0DRYgBn83Ig,1146
|
10
10
|
locust_cloud/webui/.gitignore,sha256=i8EHIqDlVm1-Dkvf_GTZmP_Wu99GE7ABfbYzHXOU734,54
|
11
11
|
locust_cloud/webui/.prettierrc,sha256=qZpzAJPlHUQ3--NHYK8WXgc_TlIqq-eoz4pbkTKK3nk,167
|
@@ -17,7 +17,7 @@ locust_cloud/webui/vite.config.ts,sha256=cqxPMkbwEA3H9mGGbuPulQUhIHCosUqm_1usxzs
|
|
17
17
|
locust_cloud/webui/yarn.lock,sha256=6BC6sHV1ufQeg1s3HoLHC2SwYs6zEVE-NHVg_1kSuVI,227118
|
18
18
|
locust_cloud/webui/dist/index.html,sha256=ceT6hvFOq5tHWJGjwPVhlfOgvDzj8kJ1SudRmXQBggc,664
|
19
19
|
locust_cloud/webui/dist/assets/index-B-CH83Zq.js,sha256=CbLgdiLRCwxAqGNKyHOQjmll_al3lrXaPPsisboc0S4,2806387
|
20
|
-
locust_cloud-1.5.
|
21
|
-
locust_cloud-1.5.
|
22
|
-
locust_cloud-1.5.
|
23
|
-
locust_cloud-1.5.
|
20
|
+
locust_cloud-1.5.1.dist-info/METADATA,sha256=NyeE-MoDvpaTrvkNHs126aNF0v2SN3n1L3Jmdz3eIRs,1663
|
21
|
+
locust_cloud-1.5.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
22
|
+
locust_cloud-1.5.1.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
|
23
|
+
locust_cloud-1.5.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|