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

# BufferedEntry

# BufferedEntry

The type for items held in the [Monitor](/docs/reference/sdk/v2/typescript/classes/monitor)'s internal buffer before they are flushed to the Adaline API.

## Import

```typescript theme={null}
import type { BufferedEntry } from '@adaline/client';
```

## Definition

```typescript theme={null}
type BufferedEntry =
  | { ready: boolean; category: 'trace'; data: Trace }
  | { ready: boolean; category: 'span'; data: Span };
```

***

## Fields

| Field      | Type                                                                                                         | Description                                                                                                   |
| ---------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| `ready`    | `boolean`                                                                                                    | Whether the entry is ready to be flushed. An entry becomes ready when `end()` is called on the trace or span. |
| `category` | `'trace' \| 'span'`                                                                                          | Discriminant that identifies the entry type.                                                                  |
| `data`     | [`Trace`](/docs/reference/sdk/v2/typescript/classes/trace) \| [`Span`](/docs/reference/sdk/v2/typescript/classes/span) | The trace or span instance held in the buffer.                                                                |

***

## Usage

Access the monitor's `buffer` property to inspect buffered entries. This is useful for debugging flush behavior or verifying that traces and spans are being queued correctly.

```typescript theme={null}
import { Adaline } from '@adaline/client';
import type { BufferedEntry } from '@adaline/client';

const adaline = new Adaline();
const monitor = adaline.initMonitor({ projectId: 'my-project' });

const trace = monitor.logTrace({ name: 'Chat Request' });
const span = trace.logSpan({ name: 'LLM Call' });

// Inspect the buffer before ending
const buffer: BufferedEntry[] = monitor.buffer;

for (const entry of buffer) {
  if (entry.category === 'trace') {
    console.log(`Trace "${entry.data.trace.trace.name}" — ready: ${entry.ready}`);
  } else {
    console.log(`Span "${entry.data.span.span.name}" — ready: ${entry.ready}`);
  }
}

// After ending, entries become ready for flushing
span.end();
trace.end();
```

***

## See Also

* [Monitor](/docs/reference/sdk/v2/typescript/classes/monitor) — manages the buffer and flush lifecycle
* [Trace](/docs/reference/sdk/v2/typescript/classes/trace) — buffered as `category: 'trace'`
* [Span](/docs/reference/sdk/v2/typescript/classes/span) — buffered as `category: 'span'`
