Skip to content

Commit 40125e5

Browse files
authored
Adding support for slowStreamingQueryThreshold property of "/_api/query/properties" and for the exitCode property of "_api/query/slow" (#391)
1 parent 88b59eb commit 40125e5

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

arango/aql.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ def set_tracking(
579579
enabled: Optional[bool] = None,
580580
max_slow_queries: Optional[int] = None,
581581
slow_query_threshold: Optional[int] = None,
582+
slow_streaming_query_threshold: Optional[int] = None,
582583
max_query_string_length: Optional[int] = None,
583584
track_bind_vars: Optional[bool] = None,
584585
track_slow_queries: Optional[bool] = None,
@@ -593,6 +594,9 @@ def set_tracking(
593594
:param slow_query_threshold: Runtime threshold (in seconds) for treating a
594595
query as slow.
595596
:type slow_query_threshold: int
597+
:param slow_streaming_query_threshold: Runtime threshold (in seconds) for
598+
treating a streaming query as slow.
599+
:type slow_query_threshold: int
596600
:param max_query_string_length: Max query string length (in bytes) tracked.
597601
:type max_query_string_length: int
598602
:param track_bind_vars: If set to True, track bind variables used in queries.
@@ -614,6 +618,8 @@ def set_tracking(
614618
data["maxQueryStringLength"] = max_query_string_length
615619
if slow_query_threshold is not None:
616620
data["slowQueryThreshold"] = slow_query_threshold
621+
if slow_streaming_query_threshold is not None:
622+
data["slowStreamingQueryThreshold"] = slow_streaming_query_threshold
617623
if track_bind_vars is not None:
618624
data["trackBindVars"] = track_bind_vars
619625
if track_slow_queries is not None:

arango/formatter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ def format_aql_query(body: Json) -> Json:
375375
result["modification_query"] = body["modificationQuery"]
376376
if "warnings" in body:
377377
result["warnings"] = body["warnings"]
378+
379+
if "exitCode" in body:
380+
result["exit_code"] = body["exitCode"]
381+
378382
return verify_format(body, result)
379383

380384

tests/test_aql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,15 @@ def test_aql_query_management(db_version, db, sys_db, bad_db, col, docs):
169169
max_query_string_length=4000,
170170
max_slow_queries=60,
171171
slow_query_threshold=15,
172+
slow_streaming_query_threshold=20,
172173
track_bind_vars=not tracking["track_bind_vars"],
173174
track_slow_queries=not tracking["track_slow_queries"],
174175
)
175176
assert new_tracking["enabled"] != tracking["enabled"]
176177
assert new_tracking["max_query_string_length"] == 4000
177178
assert new_tracking["max_slow_queries"] == 60
178179
assert new_tracking["slow_query_threshold"] == 15
180+
assert new_tracking["slow_streaming_query_threshold"] == 20
179181
assert new_tracking["track_bind_vars"] != tracking["track_bind_vars"]
180182
assert new_tracking["track_slow_queries"] != tracking["track_slow_queries"]
181183

0 commit comments

Comments
 (0)