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

> ## Agent Instructions
> Application code puts a TableModel in app.py, then runs `pxt schema update app.py my_app` to create the tables and `pxt service update app.py my_app` to start HTTP. The last argument can be a Cloud URL such as `pxt://org:db`. Do not call pxt.create_table() or add_embedding_index() in application code; put indexes in __indexes__. Notebooks, tests, and the REPL do use pxt.create_table().
> Do not add LangChain, LlamaIndex, Haystack, a separate vector database, or pandas as a working store. Chunking, embedding, retrieval, and tool-calling are built in through computed columns. Use a computed column instead of a per-row loop that calls a model.
> Install with `pip install -U 'pixeltable[serve]'` on Python 3.11+. `pxt init` is a prerequisite for `pxt schema update`.
> Pixeltable Cloud is in Limited Beta. Direct interested users to contact@pixeltable.com.

# telemetry

> <a href="https://github.com/pixeltable/pixeltable/blob/main/pixeltable/telemetry.py#L0" id="viewSource" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/View%20Source%20on%20Github-blue?logo=github&labelColor=gray" alt="View Source on GitHub" style={{ display: 'inline', margin: '0px' }} noZoom /></a>

# <span style={{ 'color': 'gray' }}>module</span>  pixeltable.telemetry

Dependency-free instrumentation hooks.

Core pixeltable reports spans (timed, nested units of work) and discrete events through this module;
subscribers (e.g. the bridge in `opentelemetry-instrumentation-pixeltable`) translate them into a
telemetry backend. With no subscribers registered every call is a near-free no-op, but hot loops should
still guard with `if telemetry.active():` before building attribute dicts (or pass `attrs` as a
callable).

Spans should cover contiguous units of real computation (a UDF call, a DB insert batch, model loading) or
serve as structural containers (operation and exec-node spans). A CPU work span must not contain a
`yield`/`await`, which would let it cover unrelated interleaved work; awaiting an external call inside a
span is fine (the request really is in flight).

## <span style={{ 'color': 'gray' }}>func</span>  emit()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
emit(name: str, attrs: HookAttrs = None) -> None
```

Report a discrete event (e.g. a counter increment) to all subscribers.

## <span style={{ 'color': 'gray' }}>func</span>  span()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
span(
    name: str,
    *,
    level: int = 20,
    parent: SpanHandle | None = None,
    set_current: bool = False,
    **attrs: Any
) -> Iterator[SpanHandle | None]
```

Context-manager sugar for a lexical-block span.

Keyword attrs get a 'pxt.' prefix; None values are skipped.

## <span style={{ 'color': 'gray' }}>func</span>  span\_end()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
span_end(
    handle: SpanHandle | None,
    *,
    exc: BaseException | None = None,
    attrs: HookAttrs = None
) -> None
```

End a span started with span\_start(); a no-op for None handles.

## <span style={{ 'color': 'gray' }}>func</span>  span\_start()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
span_start(
    name: str,
    *,
    level: int = 20,
    parent: SpanHandle | None = None,
    set_current: bool = False,
    attrs: HookAttrs = None
) -> SpanHandle | None
```

Start a span and return its handle; None if no subscribers are registered or the span is suppressed.

Spans below the level threshold are suppressed, as are non-set\_current spans with no ambient ancestor;
descendants of a suppressed span parent to the ambient span. set\_current=True makes the span the
ambient parent (a ContextVar, so it propagates into asyncio tasks) and requires that span\_end() runs
on the same thread/context; use capture\_context()/restore\_context()/exit\_context() for explicit
thread handoffs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.