langfuse / langfuse/langfuse-python

Scores bypass sample_rate since v4

Open
#1,890 0 comments 0 reactions 1 assignee View on GitHub

@hassiebp is already working on this.

Since Sep 18, 2026.

feat-scores sdk-python unconfirmed-bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.