---
title: "JobClient.query_spans"
description: "Query spans emitted while running a job. Pagination is handled automatically."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://tilebox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# JobClient.query_spans

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```python
def JobClient.query_spans(job_id: Job | UUID | str) -> Spans
```

Query spans emitted while running a job. Pagination is handled automatically.

## Parameters

**job_id**

type: Job | UUID | str

required: true

The job, job ID, or job ID string to query spans for.

## Returns

A `Spans` list. Each `Span` contains `start_time`, `end_time`, `duration`, `trace_id`, `span_id`, `parent_span_id`, `name`, `status_code`, `status_message`, `attributes`, `runner_attributes`, and `events`.

`Spans.to_pandas()` converts the spans to a pandas DataFrame and includes a computed `duration` column.

<h2 id="request-example">Usage example</h2>

```python
spans = client.jobs().query_spans(job.id)

for span in spans:
    print(
        span.name, span.status_code, span.duration
    )

df = spans.to_pandas()
```

Source: https://tilebox.com/docs/api-reference/python/tilebox.workflows/JobClient.query_spans/index.mdx
