Skip to content

Commit 90b012f

Browse files
authored
Update traces to include cache tokens (#248)
1 parent 09cdb3f commit 90b012f

File tree

1 file changed

+8
-0
lines changed
  • docs/user-guide/observability-evaluation

1 file changed

+8
-0
lines changed

docs/user-guide/observability-evaluation/traces.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Each trace consists of multiple spans that represent different operations in you
3030
| - gen_ai.usage.completion_tokens: <number> |
3131
| - gen_ai.usage.output_tokens: <number> |
3232
| - gen_ai.usage.total_tokens: <number> |
33+
| - gen_ai.usage.cache_read_input_tokens: <number> |
34+
| - gen_ai.usage.cache_write_input_tokens: <number> |
3335
| |
3436
| +-------------------------------------------------------------------------------+ |
3537
| | Cycle <cycle-id> | |
@@ -56,6 +58,8 @@ Each trace consists of multiple spans that represent different operations in you
5658
| | | - gen_ai.usage.completion_tokens: <number> | | |
5759
| | | - gen_ai.usage.output_tokens: <number> | | |
5860
| | | - gen_ai.usage.total_tokens: <number> | | |
61+
| | | - gen_ai.usage.cache_read_input_tokens: <number> | | |
62+
| | | - gen_ai.usage.cache_write_input_tokens: <number> | | |
5963
| | +-----------------------------------------------------------------------+ | |
6064
| | | |
6165
| | +-----------------------------------------------------------------------+ | |
@@ -179,6 +183,8 @@ Strands traces include rich attributes that provide context for each operation:
179183
| `gen_ai.usage.completion_tokens` | Total tokens used for completions |
180184
| `gen_ai.usage.output_tokens` | Total tokens used for completions (duplicate) |
181185
| `gen_ai.usage.total_tokens` | Total token usage |
186+
| `gen_ai.usage.cache_read_input_tokens` | Number of input tokens read from cache (Note: Not all model providers support cache tokens. This defaults to 0 in that case) |
187+
| `gen_ai.usage.cache_write_input_tokens` | Number of input tokens written to cache (Note: Not all model providers support cache tokens. This defaults to 0 in that case) |
182188

183189
### Cycle-Level Attributes
184190

@@ -209,6 +215,8 @@ Strands traces include rich attributes that provide context for each operation:
209215
| `gen_ai.usage.completion_tokens` | Total tokens used for completions |
210216
| `gen_ai.usage.output_tokens` | Total tokens used for completions (duplicate) |
211217
| `gen_ai.usage.total_tokens` | Total token usage |
218+
| `gen_ai.usage.cache_read_input_tokens` | Number of input tokens read from cache (Note: Not all model providers support cache tokens. This defaults to 0 in that case) |
219+
| `gen_ai.usage.cache_write_input_tokens` | Number of input tokens written to cache (Note: Not all model providers support cache tokens. This defaults to 0 in that case) |
212220

213221
### Tool-Level Attributes
214222

0 commit comments

Comments
 (0)