Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions langfuse/_client/span_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
span,
self._process_media_attributes(
span=span,
attributes=dict(span.attributes or {}),
attributes=_attributes_dict(span.attributes),
),
)
for span in spans
Expand Down Expand Up @@ -574,10 +574,21 @@ def _create_otel_span_data(
if instrumentation_scope
else None,
attributes=MappingProxyType(dict(attributes)),
resource_attributes=MappingProxyType(dict(span.resource.attributes or {})),
resource_attributes=MappingProxyType(
_attributes_dict(span.resource.attributes)
),
)


def _attributes_dict(
attributes: Optional[MappingCollection[str, Any]],
) -> Dict[str, AttributeValue]:
# The SDK types attribute values as the recursive ``AnyValue``, which also
# allows bytes, mappings and None. The exporter passes such values through
# unchanged, so they are treated as opaque ``AttributeValue``s here.
return cast(Dict[str, AttributeValue], dict(attributes or {}))


def _clean_attribute_value(*, key: str, value: Any) -> Optional[AttributeValue]:
cleaned_attributes = BoundedAttributes(maxlen=1, immutable=False)

Expand Down
30 changes: 15 additions & 15 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading