chore: add ability to track connections stuck at send (#4330)

* chore: add ability to track connections stuck at send

Add send_delay_seconds/send_delay_ms metrics.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roman Gershman <romange@gmail.com>
Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
This commit is contained in:
Roman Gershman 2024-12-18 08:56:36 +02:00 committed by GitHub
parent 15b293a7ec
commit bf410b6e0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 75 additions and 2 deletions

View file

@ -606,6 +606,26 @@ async def test_subscribe_in_pipeline(async_client: aioredis.Redis):
assert res == ["one", ["subscribe", "ch1", 1], "two", ["subscribe", "ch2", 2], "three"]
async def test_send_delay_metric(df_server: DflyInstance):
client = df_server.client()
await client.client_setname("client1")
blob = "A" * 1000
for j in range(10):
await client.set(f"key-{j}", blob)
await client.config_set("pipeline_queue_limit", 100)
reader, writer = await asyncio.open_connection("localhost", df_server.port)
for j in range(1000000):
writer.write(f"GET key-{j % 10}\n".encode())
@assert_eventually
async def wait_for_large_delay():
info = await client.info("clients")
assert int(info["send_delay_ms"]) > 100
await wait_for_large_delay()
async def test_match_http(df_server: DflyInstance):
client = df_server.client()
reader, writer = await asyncio.open_connection("localhost", df_server.port)