Repository navigation
fix(tracing)!: require the gen_ai. prefix in the default span filter - #1929
Conversation
is_genai_span matched any attribute key starting with "gen_ai", so lookalikes such as gen_ai_custom or gen_airflow.model exported unrelated third-party spans. Match only the gen_ai.* namespace. Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
|
@claude review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Looks good, a correct one-line namespace-boundary fix with solid test coverage.
Extended reasoning...
The change is a single-character fix in is_genai_span (langfuse/_client/span_filter.py), changing the prefix check from "gen_ai" to "gen_ai." so lookalike attribute keys like gen_ai_custom or gen_airflow.model no longer falsely match; it mirrors the existing _matches_scope_prefix boundary pattern already used in the same file. No security-sensitive surface (auth, crypto, injection) is touched—this only affects which spans are exported by default. The accompanying test additions in tests/unit/test_span_filter.py are thorough, covering matching and lookalike keys, non-string/bytes keys, and empty attributes, for both is_genai_span and is_default_export_span. The change is small, self-contained, and mechanically verified against the code.
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
…t-span-filter-requires-the-gen_ai-prefix Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
What does this PR do?
is_genai_span(used by the defaultshould_export_spanfilter) matched any attribute key starting withgen_ai. Lookalikes such asgen_ai_custom,gen_ai-request.modelorgen_airflow.modeltherefore exported unrelated third-party spans. It now matches only thegen_ai.*namespace.This is the change from #1924 (by @fallintoplace), landed on the v5 branch because it narrows what the default filter exports.
Stack: independent. Base:
prepare-v5-release. It touches onlylangfuse/_client/span_filter.pyandtests/unit/test_span_filter.py, so it can merge at any point.Type of change
Verification
Checklist
code_review.md..env.templateif needed.The PR appears safe to merge; no actionable regression was identified.
Summary
The PR narrows default GenAI span selection to attributes in the
gen_ai.*namespace and adds cases for lookalike keys and valid namespace keys.Reviews (1) · Last reviewed commit: "fix(tracing)!: require the gen_ai. prefi..."