---
title: "ExecutionContext.tracer"
description: "Tracer for creating custom spans inside the currently executing task."
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.

# ExecutionContext.tracer

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

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

```python
ExecutionContext.tracer: WorkflowTracer
```

Tracer for creating custom spans inside the currently executing task.

## Methods

```python
context.tracer.span(name: str, *args, **kwargs) -> ContextManager[Span]
context.tracer.current_span() -> Span
```

Custom spans are nested under the current task span and are exported to Tilebox with the job trace.

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

```python
from tilebox.workflows import (
    ExecutionContext,
    Task,
)


class DownloadInput(Task):
    input_id: str

    def execute(
        self, context: ExecutionContext
    ) -> None:
        with context.tracer.span(
            "download-input"
        ) as span:
            span.set_attribute(
                "input_id", self.input_id
            )
```

Source: https://tilebox.com/docs/api-reference/python/tilebox.workflows/ExecutionContext.tracer/index.mdx
