> ## 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.

# LogAttributesValue

> Allowed value type for trace and span attributes.

# LogAttributesValue

The allowed value types for key-value attributes on traces and spans. Attributes are used as `Record<string, LogAttributesValue>` throughout the observability API.

## Import

```typescript theme={null}
import type { LogAttributesValue } from '@adaline/api';
```

## Type Definition

```typescript theme={null}
type LogAttributesValue = string | number | boolean;
```

Attributes are flat key-value pairs where keys are strings and values are one of:

| Type      | Description      | Example                     |
| --------- | ---------------- | --------------------------- |
| `string`  | Text metadata    | `'us-east-1'`, `'user-456'` |
| `number`  | Numeric metadata | `1234`, `0.95`, `3`         |
| `boolean` | Boolean flags    | `true`, `false`             |

***

## Usage

Attributes appear as `Record<string, LogAttributesValue>` in these methods:

* [`monitor.logTrace()`](/docs/reference/sdk/v2/typescript/classes/monitor) — set attributes when creating a trace
* [`trace.update()`](/docs/reference/sdk/v2/typescript/classes/trace) — update attributes on an existing trace
* [`trace.logSpan()`](/docs/reference/sdk/v2/typescript/classes/trace) — set attributes when creating a span
* [`span.update()`](/docs/reference/sdk/v2/typescript/classes/span) — update attributes on an existing span

***

## Examples

### Trace Attributes

```typescript theme={null}
const trace = monitor.logTrace({
  name: 'Chat Request',
  tags: ['chat', 'production'],
  attributes: {
    userId: 'user-456',
    region: 'us-east-1',
    promptVersion: 3,
    isPremium: true
  }
});
```

### Span Attributes

```typescript theme={null}
const span = trace.logSpan({
  name: 'OpenAI Call',
  tags: ['llm'],
  attributes: {
    model: 'gpt-4o',
    temperature: 0.7,
    cached: false
  }
});
```

### Updating Attributes

```typescript theme={null}
trace.update({
  attributes: {
    latencyMs: 1234,
    tokenCount: 567,
    cacheHit: true
  }
});

span.update({
  attributes: {
    retryCount: 2,
    statusCode: 200
  }
});
```

### Typed Helper

```typescript theme={null}
import type { LogAttributesValue } from '@adaline/api';

function buildAttributes(
  userId: string,
  latencyMs: number,
  cached: boolean
): Record<string, LogAttributesValue> {
  return { userId, latencyMs, cached };
}

trace.update({
  attributes: buildAttributes('user-456', 320, false)
});
```

***

## Related

* [Trace](/docs/reference/sdk/v2/typescript/classes/trace) — accepts attributes via `logTrace()` and `trace.update()`
* [Span](/docs/reference/sdk/v2/typescript/classes/span) — accepts attributes via `logSpan()` and `span.update()`
* [Monitor](/docs/reference/sdk/v2/typescript/classes/monitor) — entry point for creating traces with attributes
