count both spans and traces

This commit is contained in:
Pratyush Shukla 2025-03-12 10:14:01 +05:30
parent a41b320580
commit d49bd89061
No known key found for this signature in database
GPG key ID: AFCF7DAD6BA1FEE2

View file

@ -81,7 +81,17 @@ class BackendSpanExporter(TracingExporter):
traces: list[dict[str, Any]] = []
spans: list[dict[str, Any]] = []
data = [item.export() for item in items if item.export()]
# Categorize items into traces and spans
for item in items:
if hasattr(item, 'export') and callable(item.export):
export_data = item.export()
if export_data:
if isinstance(item, Trace):
traces.append(export_data)
else:
spans.append(export_data)
data = traces + spans
payload = {"data": data}
headers = {