Skip to content

fix(telemetry): added latest semantic conventions as span attributes for langfuse#1768

Merged
poshinchen merged 1 commit intostrands-agents:mainfrom
poshinchen:fix/langfuse-semantic-conventions-mapping
Feb 27, 2026
Merged

fix(telemetry): added latest semantic conventions as span attributes for langfuse#1768
poshinchen merged 1 commit intostrands-agents:mainfrom
poshinchen:fix/langfuse-semantic-conventions-mapping

Conversation

@poshinchen
Copy link
Contributor

@poshinchen poshinchen commented Feb 25, 2026

Description

Currently Langfuse do not read some of the latest semantic conventions via event attributes, instead they read from the span attributes. Therefore we have to add those event attributes into span attributes when users are using langfuse.

Related Issues

N/A

Documentation PR

N/A

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link

Assessment: Request Changes

Good approach to handling Langfuse's span attribute requirements. The implementation correctly adds event attributes to span attributes when using Langfuse as the OTLP endpoint.

Review Summary
  • Code Duplication: One instance of duplicated Langfuse detection logic should use the new self.is_langfuse instance variable for consistency
  • Refactoring: The removal of the _set_attributes wrapper method in favor of direct span.set_attributes() calls is a nice simplification
  • Testing: Good test coverage for both Langfuse and non-Langfuse scenarios

Once the duplicated check is replaced with self.is_langfuse, this is ready to merge.

@poshinchen poshinchen force-pushed the fix/langfuse-semantic-conventions-mapping branch from fee77b9 to d6086d3 Compare February 26, 2026 18:35
@github-actions github-actions bot added size/m and removed size/m labels Feb 26, 2026
@poshinchen poshinchen force-pushed the fix/langfuse-semantic-conventions-mapping branch from d6086d3 to 1cc145d Compare February 26, 2026 20:09
@github-actions github-actions bot added size/m and removed size/m labels Feb 26, 2026
afarntrog
afarntrog previously approved these changes Feb 26, 2026
JackYPCOnline
JackYPCOnline previously approved these changes Feb 27, 2026
@poshinchen poshinchen force-pushed the fix/langfuse-semantic-conventions-mapping branch from 1cc145d to a28e96d Compare February 27, 2026 18:37
@github-actions github-actions bot added size/m and removed size/m labels Feb 27, 2026
@poshinchen poshinchen dismissed stale reviews from JackYPCOnline and afarntrog via 545b630 February 27, 2026 20:12
@poshinchen poshinchen force-pushed the fix/langfuse-semantic-conventions-mapping branch from a28e96d to 545b630 Compare February 27, 2026 20:12
@github-actions github-actions bot added size/m and removed size/m labels Feb 27, 2026
@github-actions
Copy link

Assessment: Approve

The previous feedback has been addressed. The implementation now correctly uses self.is_langfuse consistently throughout the code.

Review Summary
  • Previous Issue Resolved: The duplicated Langfuse detection logic now uses self.is_langfuse
  • Design Improvement: is_langfuse is now a @property, which is cleaner and allows runtime environment variable changes to be picked up
  • Code Simplification: The _set_attributes wrapper method was removed in favor of direct span.set_attributes() calls
  • Testing: Tests properly updated to reflect the implementation changes

Nice work on this fix! 🎉

@poshinchen poshinchen merged commit 2c83216 into strands-agents:main Feb 27, 2026
20 checks passed
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants