Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jun 24, 2025

Important

Add feature to filter spans by instrumentation scope name in Langfuse client, with tests verifying the behavior.

  • Feature:
    • Add blocked_instrumentation_scopes parameter to Langfuse in client.py, LangfuseResourceManager in resource_manager.py, and LangfuseSpanProcessor in span_processor.py to filter spans by instrumentation scope name.
    • Spans from blocked scopes are not exported to Langfuse.
  • Tests:
    • Add TestInstrumentationScopeFiltering in test_otel.py to verify filtering behavior.
    • Tests include scenarios with blocked scopes, no blocked scopes, and blocking Langfuse's own scope.
  • Misc:
    • Update imports in resource_manager.py and span_processor.py to include List for type hinting.

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

Greptile Summary

Disclaimer: Experimental PR review

Added instrumentation scope filtering to the Langfuse Python SDK, allowing selective blocking of spans from specific sources before export to Langfuse.

  • Added blocked_instrumentation_scopes parameter to Langfuse client and LangfuseResourceManager for configuring span filtering
  • Implemented _is_blocked_instrumentation_scope method in LangfuseSpanProcessor to handle span filtering logic
  • Updated type hints and docstrings across affected modules to reflect new filtering capabilities
  • Added comprehensive test suite in tests/test_otel.py covering various filtering scenarios (empty lists, specific libraries, edge cases)

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.

LGTM

4 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp merged commit 0ce92db into main Jun 24, 2025
10 checks passed
@hassiebp hassiebp deleted the allow-filtering-instrumentation-scopes branch June 24, 2025 14:45
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