Skip to content

Commit

Permalink
perf(ingestion): make max event and batch size configurable (#1103)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp authored Feb 5, 2025
1 parent 969ee3f commit f2a0824
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions langfuse/_task_manager/ingestion_consumer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
import logging
import os
import threading
import time

from queue import Empty, Queue
from typing import Any, List, Optional

Expand All @@ -21,8 +21,8 @@

from .media_manager import MediaManager

MAX_EVENT_SIZE_BYTES = 1_000_000
MAX_BATCH_SIZE_BYTES = 2_500_000
MAX_EVENT_SIZE_BYTES = int(os.environ.get("LANGFUSE_MAX_EVENT_SIZE_BYTES", 1_000_000))
MAX_BATCH_SIZE_BYTES = int(os.environ.get("LANGFUSE_MAX_BATCH_SIZE_BYTES", 2_500_000))


class IngestionMetadata(pydantic.BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,9 @@ def _generate_random_dict(n: int, key_length: int = 8) -> Dict[str, Any]:
overhead = duration_with_langfuse - duration_without_langfuse
print(f"Langfuse overhead: {overhead}ms")

assert overhead < 50, f"Langfuse tracing overhead of {overhead}ms exceeds threshold"
assert (
overhead < 100
), f"Langfuse tracing overhead of {overhead}ms exceeds threshold"

handler.flush()

Expand Down

0 comments on commit f2a0824

Please sign in to comment.