count both spans and traces

This commit is contained in:
Pratyush Shukla 2025-03-12 10:14:01 +05:30
parent e0d6a49e14
commit 93bca7bf11
1 changed files with 11 additions and 1 deletions

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 = {