Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented May 21, 2025

Important

Add environment attribute propagation to span and generation methods in client.py and span.py.

  • Behavior:
    • Add environment attribute propagation in start_span(), start_as_current_span(), _start_as_current_otel_span_with_processed_media(), update_current_span(), and update_current_trace() in client.py.
    • Add environment attribute to LangfuseSpan and LangfuseGeneration constructors in span.py.
  • Classes:
    • LangfuseSpan and LangfuseGeneration now include environment in their initialization and attribute setting.
  • Misc:
    • Update docstrings in span.py to include environment parameter.

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

Greptile Summary

Disclaimer: Experimental PR review

This PR fixes environment attribute propagation in the Langfuse Python client by ensuring proper environment context handling throughout the tracing system.

  • Added environment parameter to LangfuseSpanWrapper constructor in langfuse/_client/span.py to initialize environment context
  • Modified span creation methods in langfuse/_client/client.py to pass environment attribute to child spans
  • Added environment attribute setting in LangfuseSpanWrapper when provided to ensure proper tracking
  • Ensured environment propagation through all span hierarchy methods for consistent tracing

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

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp merged commit d2e7e2d into main May 22, 2025
8 of 10 checks passed
@hassiebp hassiebp deleted the fix-v3-environments branch May 22, 2025 08:23
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