@@ -40,9 +40,9 @@ def test_latency(
40
40
url : str = Form ("" ),
41
41
interval : float = Form (1.0 ),
42
42
period : int = Form (10 ),
43
+ custom_sql : str = Form ("" ),
43
44
user : str = Depends (get_current_user )
44
45
):
45
- # All credentials are held transiently only for test run
46
46
result = dbtools .run_latency_test (
47
47
dbtype = dbtype ,
48
48
host = host ,
@@ -52,9 +52,9 @@ def test_latency(
52
52
database = database ,
53
53
url = url ,
54
54
interval = interval ,
55
- period = period
55
+ period = period ,
56
+ custom_sql = custom_sql
56
57
)
57
- # Render index.html with results below
58
58
return templates .TemplateResponse ("index.html" , {
59
59
"request" : request ,
60
60
"user" : user ,
@@ -66,7 +66,8 @@ def test_latency(
66
66
"database" : database ,
67
67
"url" : url ,
68
68
"interval" : interval ,
69
- "period" : period
69
+ "period" : period ,
70
+ "custom_sql" : custom_sql
70
71
})
71
72
72
73
@app .post ("/api/test-latency" )
@@ -80,9 +81,9 @@ def api_test_latency(
80
81
url : str = Form ("" ),
81
82
interval : float = Form (1.0 ),
82
83
period : int = Form (10 ),
84
+ custom_sql : str = Form ("" ),
83
85
credentials : HTTPBasicCredentials = Depends (security )
84
86
):
85
- # For API/CLI use -- returns result JSON
86
87
get_current_user (credentials )
87
88
result = dbtools .run_latency_test (
88
89
dbtype = dbtype ,
@@ -93,6 +94,7 @@ def api_test_latency(
93
94
database = database ,
94
95
url = url ,
95
96
interval = interval ,
96
- period = period
97
+ period = period ,
98
+ custom_sql = custom_sql
97
99
)
98
100
return JSONResponse (result )
0 commit comments