Skip to content
Open
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 langfuse/_client/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,11 @@ def _init_tracer_provider(
otel_trace_api.set_tracer_provider(provider)

else:
if sample_rate is not None and sample_rate < 1:
langfuse_logger.warning(
"Configuration: sample_rate was ignored because an OpenTelemetry TracerProvider is already registered. "
"Configure the sampler on your own TracerProvider instead."
)
if id_generator is not None:
langfuse_logger.warning(
"Configuration: id_generator was ignored because an OpenTelemetry TracerProvider is already registered. "
Expand Down
5 changes: 4 additions & 1 deletion langfuse/_task_manager/score_ingestion_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def execute_task_with_backoff(batch: List[Any]) -> None:
and 400 <= int(e.status) < 500
and int(e.status) != 429 # retry if rate-limited
):
return
# Non-retryable 4xx: the batch is permanently lost.
# Raise so handle_exception logs the loss instead of
# silently pretending the batch was delivered.
raise e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Permanent failures are retried

When the API returns a non-rate-limited 4xx response such as 400 or 401, raising here causes the surrounding backoff.on_exception(..., Exception, max_tries=self._max_retries) decorator to retry the request. The rejected batch is therefore submitted up to three times with exponential delays before handle_exception logs the loss, which delays flush() and treats a permanent failure as transient. Use a backoff giveup condition, or propagate the failure only after leaving the decorated operation.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/_task_manager/score_ingestion_consumer.py
Line: 193

Comment:
**Permanent failures are retried**

When the API returns a non-rate-limited 4xx response such as 400 or 401, raising here causes the surrounding `backoff.on_exception(..., Exception, max_tries=self._max_retries)` decorator to retry the request. The rejected batch is therefore submitted up to three times with exponential delays before `handle_exception` logs the loss, which delays `flush()` and treats a permanent failure as transient. Use a backoff `giveup` condition, or propagate the failure only after leaving the decorated operation.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.


raise e

Expand Down