langfuse / langfuse/langfuse-python
Scores bypass sample_rate since v4
@hassiebp is already working on this.
Since Sep 18, 2026.
- Dominant language
- Python
- Stars
- 467
- Forks
- 348
- Avg merge
- 12h 16m
- Merged PRs (30d)
- 27
Description
Since 4.0.0, sample_rate is applied to traces but not to scores. A run sampled at 0.001 still uploads a score for every sample, all pointing at traces that were never exported.
The reason is that create_score builds the ScoreBody with camelCase kwargs (traceId, observationId, ...). The v4 Fern models expect the snake_case field names and, because extra is allowed, quietly store the camelCase ones as extras. So body.trace_id is None, and add_score_task treats every score as a session score and skips the sampler. The request still looks right on the wire only because model_dump passes the extras through.
Check: sample_rate 0.001, 2000 generations, one create_score per generation. On 3.10.3 that enqueues 2 scores. On 4.0.0 and 4.15.4 it enqueues about 1770.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.