Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions arangoasync/aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ async def set_tracking(
enabled: Optional[bool] = None,
max_slow_queries: Optional[int] = None,
slow_query_threshold: Optional[int] = None,
slow_streaming_query_threshold: Optional[int] = None,
max_query_string_length: Optional[int] = None,
track_bind_vars: Optional[bool] = None,
track_slow_queries: Optional[int] = None,
Expand All @@ -382,6 +383,8 @@ async def set_tracking(
entries are discarded first.
slow_query_threshold (int | None): Runtime threshold (in seconds) for treating a
query as slow.
slow_streaming_query_threshold (int | None): Runtime threshold (in seconds) for
treating a streaming query as slow.
max_query_string_length (int | None): The maximum query string length (in bytes)
to keep in the list of queries.
track_bind_vars (bool | None): If set to `True`, track bind variables used in
Expand Down Expand Up @@ -409,6 +412,8 @@ async def set_tracking(
data["maxQueryStringLength"] = max_query_string_length
if slow_query_threshold is not None:
data["slowQueryThreshold"] = slow_query_threshold
if slow_streaming_query_threshold is not None:
data["slowStreamingQueryThreshold"] = slow_streaming_query_threshold
if track_bind_vars is not None:
data["trackBindVars"] = track_bind_vars
if track_slow_queries is not None:
Expand Down
9 changes: 8 additions & 1 deletion tests/test_aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ async def test_query_tracking(db, bad_db):
assert tracking.enabled is False

# Re-enable.
tracking = await aql.set_tracking(enabled=True, max_slow_queries=5)
tracking = await aql.set_tracking(
enabled=True,
max_slow_queries=5,
slow_streaming_query_threshold=20,
slow_query_threshold=15,
)
assert tracking.enabled is True
assert tracking.max_slow_queries == 5
assert tracking.slow_streaming_query_threshold == 20
assert tracking.slow_query_threshold == 15

# Exceptions with bad database
with pytest.raises(AQLQueryTrackingGetError):
Expand Down
Loading