Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))
Fetch all Root spans for a time interval
A root span is the top-level span in a trace hierarchy that has no parent span.Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", parent_span_ids=[""], limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))
Fetch all spans for virtual accounts
Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", created_by_subject_types=["virtualaccount"], limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))
Fetch all spans for a virtual account `exampleaccount`
Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", created_by_subject_slugs=["exampleaccount"], limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))
Fetch all spans for users
Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", created_by_subject_types=["user"], limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))
Fetch all spans for a user with email example@email.com
Define the time range for your query. Use ISO 8601 format for timestamps.
from truefoundry import clientfrom truefoundry_sdk import SortDirectionspans = client.traces.query_spans( data_routing_destination="default", start_time="2025-10-08T00:00:00.000Z", end_time="2025-10-08T23:59:59.999Z", created_by_subject_slugs=["example@email.com"], limit=200, sort_direction=SortDirection.DESC)# Process all spans across all pagesfor span in spans: print(span.span_name, span.duration, span.span_attributes.get("tfy.span_type"))