Skip to content

Commit e7b829e

Browse files
committed
Adding support for slowStreamingQueryThreshold property of "/_api/query/properties"
1 parent 8519aa8 commit e7b829e

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

arangoasync/aql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ async def set_tracking(
369369
enabled: Optional[bool] = None,
370370
max_slow_queries: Optional[int] = None,
371371
slow_query_threshold: Optional[int] = None,
372+
slow_streaming_query_threshold: Optional[int] = None,
372373
max_query_string_length: Optional[int] = None,
373374
track_bind_vars: Optional[bool] = None,
374375
track_slow_queries: Optional[int] = None,
@@ -382,6 +383,8 @@ async def set_tracking(
382383
entries are discarded first.
383384
slow_query_threshold (int | None): Runtime threshold (in seconds) for treating a
384385
query as slow.
386+
slow_streaming_query_threshold (int | None): Runtime threshold (in seconds) for
387+
treating a streaming query as slow.
385388
max_query_string_length (int | None): The maximum query string length (in bytes)
386389
to keep in the list of queries.
387390
track_bind_vars (bool | None): If set to `True`, track bind variables used in
@@ -409,6 +412,8 @@ async def set_tracking(
409412
data["maxQueryStringLength"] = max_query_string_length
410413
if slow_query_threshold is not None:
411414
data["slowQueryThreshold"] = slow_query_threshold
415+
if slow_streaming_query_threshold is not None:
416+
data["slowStreamingQueryThreshold"] = slow_streaming_query_threshold
412417
if track_bind_vars is not None:
413418
data["trackBindVars"] = track_bind_vars
414419
if track_slow_queries is not None:

tests/test_aql.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,16 @@ async def test_query_tracking(db, bad_db):
6464
assert tracking.enabled is False
6565

6666
# Re-enable.
67-
tracking = await aql.set_tracking(enabled=True, max_slow_queries=5)
67+
tracking = await aql.set_tracking(
68+
enabled=True,
69+
max_slow_queries=5,
70+
slow_streaming_query_threshold=20,
71+
slow_query_threshold=15,
72+
)
6873
assert tracking.enabled is True
6974
assert tracking.max_slow_queries == 5
75+
assert tracking.slow_streaming_query_threshold == 20
76+
assert tracking.slow_query_threshold == 15
7077

7178
# Exceptions with bad database
7279
with pytest.raises(AQLQueryTrackingGetError):

0 commit comments

Comments
 (0)