Skip to content

Commit 4aaa55d

Browse files
committed
more redis cleanup
1 parent 32e3d7d commit 4aaa55d

12 files changed

Lines changed: 2 additions & 166 deletions

File tree

api/oss/src/apis/fastapi/sessions/router.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ async def respond_interaction(
850850
interaction_id=str(interaction_id),
851851
answer=answer,
852852
)
853-
log.tick("interactions.enqueued", dims={"queue": "interactions"})
854853
else:
855854
references = (
856855
{

api/oss/src/apis/fastapi/triggers/router.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,10 +1602,8 @@ async def ingest_composio_event(
16021602
),
16031603
timeout=_ENQUEUE_TIMEOUT_SECONDS,
16041604
)
1605-
log.tick("triggers.enqueued", dims={"queue": "triggers"})
16061605
except Exception as e:
16071606
log.error("Failed to enqueue trigger event: %s", e)
1608-
log.tick("triggers.enqueue_errors", dims={"queue": "triggers"})
16091607
raise HTTPException(
16101608
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
16111609
detail="Failed to enqueue trigger event",

api/oss/src/core/evaluations/runtime/runner.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ async def process_run_from_source(
3838
kwargs["oldest"] = oldest
3939

4040
result = await self.worker.process_run_from_source.kiq(**kwargs)
41-
log.tick(
42-
"evaluations.enqueued",
43-
dims={"queue": "evaluations"},
44-
task="run_from_source",
45-
)
4641
return result
4742

4843
async def process_run_from_batch(
@@ -76,9 +71,6 @@ async def process_run_from_batch(
7671
kwargs["input_step_key"] = input_step_key
7772

7873
result = await self.worker.process_run_from_batch.kiq(**kwargs)
79-
log.tick(
80-
"evaluations.enqueued", dims={"queue": "evaluations"}, task="run_from_batch"
81-
)
8274
return result
8375

8476
async def process_rerun(
@@ -116,5 +108,4 @@ async def process_rerun(
116108
kwargs["overwrite"] = overwrite
117109

118110
result = await self.worker.process_rerun.kiq(**kwargs)
119-
log.tick("evaluations.enqueued", dims={"queue": "evaluations"}, task="rerun")
120111
return result

api/oss/src/core/events/streaming.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,7 @@ async def publish_event(
8989
maxlen=MAXLEN_STREAMS_EVENTS,
9090
approximate=True,
9191
)
92-
log.tick(
93-
"events.published",
94-
bytes=len(event_bytes),
95-
dims={"stream": "events"},
96-
)
9792
return True
9893
except Exception as e:
9994
log.error(f"[EVENTS] Failed to publish event: {e}", exc_info=True)
100-
log.tick("events.publish_errors", dims={"stream": "events"})
10195
return False

api/oss/src/core/sessions/records/streaming.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,7 @@ async def publish_record(
9191
maxlen=MAXLEN_STREAMS_RECORDS,
9292
approximate=True,
9393
)
94-
log.tick(
95-
"records.published",
96-
bytes=len(event_bytes),
97-
dims={"stream": "records"},
98-
)
9994
return True
10095
except Exception as e:
10196
log.error(f"[RECORDS] Failed to publish: {e}", exc_info=True)
102-
log.tick("records.publish_errors", dims={"stream": "records"})
10397
return False

api/oss/src/core/tracing/streaming.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import zlib
2-
from time import perf_counter
32
from typing import List
43
from uuid import UUID
54

@@ -84,7 +83,6 @@ async def publish_spans(
8483

8584
count = 0
8685
total_bytes = 0
87-
started = perf_counter()
8886

8987
# Full span_dtos list is already in hand, so pipeline all XADDs into one
9088
# round-trip instead of one XADD per span on the firehose.
@@ -111,12 +109,4 @@ async def publish_spans(
111109
if count:
112110
await pipe.execute()
113111

114-
log.tick(
115-
"spans.published",
116-
count=count,
117-
bytes=total_bytes,
118-
duration_ms=(perf_counter() - started) * 1000,
119-
dims={"stream": "spans"},
120-
)
121-
122112
return count

api/oss/src/core/triggers/service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,6 @@ async def refresh_schedules(
15601560
timeout=_ENQUEUE_TIMEOUT_SECONDS,
15611561
)
15621562

1563-
log.tick("triggers.enqueued", dims={"queue": "triggers"})
15641563
log.info(
15651564
"[SCHEDULE] Dispatched. ",
15661565
project_id=project_id,

api/oss/src/tasks/asyncio/events/worker.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import time
32
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
43
from uuid import UUID
54

@@ -218,15 +217,11 @@ async def run(self):
218217

219218
while True:
220219
try:
221-
# 1. Read batch from stream (idle blocks return empty, never tick)
222-
read_started = time.perf_counter()
220+
# 1. Read batch from stream
223221
batch = await self.read_batch()
224222
if not batch:
225223
continue
226224

227-
read_ms = (time.perf_counter() - read_started) * 1000
228-
started = time.perf_counter()
229-
230225
# 2. Process batch
231226
ingested, processed_ids, batches = await self.process_batch(batch)
232227

@@ -245,10 +240,6 @@ async def run(self):
245240
"[EVENTS] Skipping ACK/DEL due to webhook dispatch failure",
246241
batch_size=len(batch),
247242
)
248-
log.tick(
249-
f"{self.metric_stream}.errors",
250-
dims={"stream": self.metric_stream},
251-
)
252243
continue
253244
else:
254245
log.info(
@@ -264,16 +255,6 @@ async def run(self):
264255
batch_size=len(batch),
265256
ingested=ingested,
266257
)
267-
log.tick(
268-
f"{self.metric_stream}.processed",
269-
count=len(processed_ids),
270-
duration_ms=(time.perf_counter() - started) * 1000,
271-
read_ms=read_ms,
272-
dims={"stream": self.metric_stream},
273-
)
274258
except Exception:
275259
log.error("[EVENTS] Worker loop error", exc_info=True)
276-
log.tick(
277-
f"{self.metric_stream}.errors", dims={"stream": self.metric_stream}
278-
)
279260
await asyncio.sleep(1)

api/oss/src/tasks/asyncio/shared/consumer.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,37 +182,19 @@ async def run(self):
182182

183183
while True:
184184
try:
185-
read_started = time.perf_counter()
186185
batch = await self.read_batch()
187186
if not batch:
188187
continue
189188

190-
# read_ms = fetch + batch accumulation (the consumer's Redis-read
191-
# latency, symmetric with the producer's XADD latency); duration_ms
192-
# = process + ack only. Idle 5s blocks return empty and never tick.
193-
read_ms = (time.perf_counter() - read_started) * 1000
194-
started = time.perf_counter()
195-
processed_count, processed_message_ids = await self.process_batch(batch)
189+
_, processed_message_ids = await self.process_batch(batch)
196190

197191
if processed_message_ids:
198192
await self.ack_and_delete(processed_message_ids)
199193

200-
log.tick(
201-
f"{self.metric_stream}.processed",
202-
count=processed_count,
203-
duration_ms=(time.perf_counter() - started) * 1000,
204-
read_ms=read_ms,
205-
dims={"stream": self.metric_stream},
206-
)
207-
208194
except Exception:
209195
log.error(
210196
f"{self.log_prefix} Error in worker loop",
211197
exc_info=True,
212198
)
213-
log.tick(
214-
f"{self.metric_stream}.errors",
215-
dims={"stream": self.metric_stream},
216-
)
217199
# Sleep before retry to avoid tight error loop
218200
await asyncio.sleep(1)

api/oss/src/tasks/asyncio/webhooks/dispatcher.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,14 @@ async def dispatch(
321321
f"delivery={delivery_id} event={event.event_id} "
322322
f"subscription={sub.id}"
323323
)
324-
log.tick("webhooks.enqueued", dims={"queue": "webhooks"})
325324
except Exception as e:
326325
log.error(
327326
f"[WEBHOOKS DISPATCHER] Failed to enqueue delivery "
328327
f"for subscription {sub.id}: {e}"
329328
)
330-
log.tick("webhooks.enqueue_errors", dims={"queue": "webhooks"})
331329
enqueue_failures += 1
332330

333331
if enqueue_failures > 0:
334-
log.tick(
335-
"webhooks.enqueue_failures",
336-
count=enqueue_failures,
337-
dims={"queue": "webhooks"},
338-
)
339332
# Raise so the events worker skips ACK/DEL and retries the whole batch. Without this
340333
# the batch is acked and the failed deliveries are dropped for good. Redelivery is
341334
# safe: the deterministic delivery_id dedups already-enqueued deliveries.

0 commit comments

Comments
 (0)