Skip to content

Commit f2a0824

Browse files
authored
perf(ingestion): make max event and batch size configurable (#1103)
1 parent 969ee3f commit f2a0824

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

langfuse/_task_manager/ingestion_consumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
22
import logging
3+
import os
34
import threading
45
import time
5-
66
from queue import Empty, Queue
77
from typing import Any, List, Optional
88

@@ -21,8 +21,8 @@
2121

2222
from .media_manager import MediaManager
2323

24-
MAX_EVENT_SIZE_BYTES = 1_000_000
25-
MAX_BATCH_SIZE_BYTES = 2_500_000
24+
MAX_EVENT_SIZE_BYTES = int(os.environ.get("LANGFUSE_MAX_EVENT_SIZE_BYTES", 1_000_000))
25+
MAX_BATCH_SIZE_BYTES = int(os.environ.get("LANGFUSE_MAX_BATCH_SIZE_BYTES", 2_500_000))
2626

2727

2828
class IngestionMetadata(pydantic.BaseModel):

tests/test_langchain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,9 @@ def _generate_random_dict(n: int, key_length: int = 8) -> Dict[str, Any]:
21842184
overhead = duration_with_langfuse - duration_without_langfuse
21852185
print(f"Langfuse overhead: {overhead}ms")
21862186

2187-
assert overhead < 50, f"Langfuse tracing overhead of {overhead}ms exceeds threshold"
2187+
assert (
2188+
overhead < 100
2189+
), f"Langfuse tracing overhead of {overhead}ms exceeds threshold"
21882190

21892191
handler.flush()
21902192

0 commit comments

Comments
 (0)