Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jul 4, 2025

Important

In resource_manager.py, add_score_task now defaults to in-sample if OpenTelemetry sampler is unavailable, ensuring scores are processed correctly.

  • Behavior:
    • In add_score_task in resource_manager.py, skip sampling if OpenTelemetry sampler is not available by defaulting to in-sample.
    • Handles cases where event['body'].trace_id is None by ensuring scores are not sampled out.
  • Misc:
    • Minor refactoring in add_score_task to improve readability and logic flow.

This description was created by Ellipsis for d77d697. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Fixes scoring sampling behavior in the Python SDK to ensure scores are not unintentionally dropped when OpenTelemetry sampling is not configured.

  • Modified langfuse/_client/resource_manager.py to treat scores as 'in-sample' by default when using ProxyTracerProvider
  • This prevents scores from being silently filtered when OTEL sampling is misconfigured
  • Improves code readability through better structured sampling condition logic

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp enabled auto-merge (squash) July 4, 2025 12:55
@hassiebp hassiebp disabled auto-merge July 4, 2025 13:09
@hassiebp hassiebp merged commit 2163794 into main Jul 4, 2025
8 of 10 checks passed
@hassiebp hassiebp deleted the fix-sampling-score-missing-otel branch July 4, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants