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

# Span Attributes

> Guide to span attributes and custom metadata

Attributes are key-value pairs attached to spans for filtering and analysis.

***

## Standard Attributes

Automatically extracted by Lumina:

| Attribute           | Type   | Description         |
| ------------------- | ------ | ------------------- |
| `model`             | string | LLM model name      |
| `prompt_tokens`     | int    | Input tokens        |
| `completion_tokens` | int    | Output tokens       |
| `cost_usd`          | float  | Calculated cost     |
| `latency_ms`        | int    | Duration            |
| `status`            | string | Success/error state |

***

## Custom Attributes

Add your own:

```typescript theme={null}
await lumina.trace('operation', async (span) => {
  span.setAttribute('userId', 'user-123');
  span.setAttribute('priority', 'high');
  span.setAttribute('retries', 3);
});
```

***

## Querying by Attributes

Filter traces by attributes in the dashboard:

```
userId = "user-123"
cost_usd > 0.5
priority = "high"
```

***

## Best Practices

**Use consistent naming:**

```typescript theme={null}
// Good
userId, sessionId, featureFlag

// Bad
uid, SessionID, flag
```

**Add context:**

```typescript theme={null}
span.setAttribute('model', 'gpt-4');
span.setAttribute('temperature', 0.7);
span.setAttribute('max_tokens', 1000);
```
