from line 1
11# Configure a custom OpenTelemetry collector
22
3> Route the full Claude for M365 audit trail, including prompts, tool inputs and outputs, and document references, to an OpenTelemetry collector you operate.
3> Route the Claude for M365 audit trail, including prompts, tool inputs and outputs, and document references, to an OpenTelemetry collector you operate.
44
5Route complete audit telemetry from Claude for Excel, PowerPoint, Word,
5Route audit telemetry from Claude for Excel, PowerPoint, Word,
66and Outlook to your own OpenTelemetry (OTEL) collector. This gives you
77control over retention and encryption and lets you feed the data into a
88SIEM or observability platform.
from line 9
99
1010This capability is available to Claude Enterprise organizations and to
1111direct-provider deployments on Amazon Bedrock, Google Cloud Vertex AI,
12Azure AI Foundry, or an LLM gateway.
12Microsoft Foundry, or an LLM gateway.
1313
1414## What the collector receives
1515
1616When a custom collector is configured, the add-in sends trace data for
1717every user turn. Each turn produces a tree of spans covering the prompt,
18each model call, each tool execution, file uploads, and context
19compaction.
18model calls, tool executions, and context compaction. Each uploaded file
19has a span of its own, outside that tree.
2020
2121For the setups described under [Set up the collector](#set-up-the-collector),
2222all span attributes are included. They carry user-generated content:
2323prompt text, tool inputs and outputs, and document URLs. The allowlist
2424filter that strips sensitive attributes on the Anthropic path does not
25run on this path. Tool names are still normalized: MCP connector tool
26names are recorded as the literal `mcp_tool` rather than the
25run on this path. On spans, tool names are still normalized: MCP
26connector tool names are recorded as the literal `mcp_tool` rather than the
2727connector-specific name, and any other name that is not one of the
2828add-in's own tools is recorded as `unknown_tool`. For these setups,
2929assistant response text is not included. Your organization owns the
30collected data; treat the endpoint as containing prompt and document
31content when you scope access controls and retention.
30collected data; treat the endpoint as containing prompt, document,
31mailbox, and calendar content when you scope access controls and
32retention.
3233
3334When the collector is instead delivered by an administrator-managed
3435settings document, such as the one Claude for Government delivers, the
3536add-in follows that document: it includes only the content categories
36the administrator selected, sends one log record per prompt, model call,
37and tool call to `{your_url}/v1/logs`, and sends the spans only while
37the administrator selected, sends log records for prompts, model calls,
38and tool calls to `{your_url}/v1/logs`, and sends the spans only while
3839the administrator has turned traces on.
3940
4041One of those categories is Claude's responses: when selected, the reply
from line 54
5354| `office_agent.api_request` | Each model call that completes |
5455| `office_agent.api_error` | Each model call that is refused, fails, is cut off, or that the user stops |
5556| `office_agent.assistant_response` | Each completed model call whose reply contains text, when the Claude's responses category is selected |
56| `office_agent.tool_result` | Each tool call |
57| `office_agent.tool_result` | Each tool call that the add-in records as an `agent.tool_execution` span, whether or not traces are turned on |
5758
5859Auxiliary model calls the add-in makes for itself, such as context
5960compaction (the `agent.compaction` span), the short progress headline
from line 68
6768`request_id`, and the same surface, session, member, and organization
6869attributes as its model call.
6970
71In Claude for Outlook, tool inputs and outputs can hold mail and
72calendar content, including the names, email addresses, and emails of
73people other than the user.
74
75Tool outputs can include:
76
77* Emails, attachments, and calendar entries that Claude reads with a
78 tool, with the names and email addresses of senders, recipients, and
79 attendees.
80* Other people's free and busy times, when Claude looks for a meeting
81 time. If a person's calendar sharing lets the user see that person's
82 meeting titles, the collector can receive those titles as well.
83
84Tool inputs can include:
85
86* The emails Claude drafts: the body, and any recipients and subject
87 Claude sets.
88* The meeting invitations Claude drafts, with their title, attendees,
89 time, location, and body.
90* Notes Claude saves to its scratchpad, which the add-in keeps on the
91 user's device for later conversations. These notes can name other
92 people and give their email addresses.
93
94A tool input is recorded when the tool starts, so it reaches the
95collector even if the user then declines a change the tool asks to
96make, or never sends the draft.
97
98Without Microsoft Graph consent, the add-in's own tools read the email
99or event the user has open. With
100[Microsoft Graph consent](https://claude.com/docs/office-agents/outlook.md#grant-microsoft-graph-consent),
101they can read mail and calendar entries from anywhere in the user's own
102mailbox and calendar, and look up other people's free and busy times.
103
104A collector delivered by an administrator-managed settings document
105receives tool inputs only if the administrator selected the content
106category for tool inputs. It receives tool outputs only if the
107administrator selected the category for tool outputs and turned traces
108on.
109
70110Metrics are not sent to custom collectors. The `office_agent.*` counter
71namespace routes to Anthropic only. Every counter increment is also
72recorded as a span event on the active span, so the same signals are
73recoverable from the trace stream.
111namespace routes to Anthropic only. Token usage is the only counter that
112also appears in the spans, as the `office_agent.token.usage` event
113described under [Span events](#span-events).
74114
75115Telemetry is sent over OTLP/HTTP to `{your_url}/v1/traces`, and the log
76116records above to `{your_url}/v1/logs`. gRPC is not supported because of
77117Office WebView constraints.
78118
119Every custom collector, however it is configured, also receives the
120add-in's own diagnostic log records at `{your_url}/v1/logs`. This
121includes a collector whose settings document turns traces off. Unlike
122the records in the table above, these carry no `event.name`.
123
124The add-in sends a record when it logs a warning or an error.
125
126The body of a record is a fixed message from the add-in's code. It is
127not text from the conversation, the document, or an error message. For
128example, a failed tool call sends a record whose body is
129`tool_execution_failed`.
130
131The records are not a count of failures:
132
133* A tool call that fails in a way the add-in expects, such as a change
134 the user declined or a tool a policy blocked, sends no
135 `tool_execution_failed` record. Some policy refusals send a record of
136 their own.
137* When a script that Claude wrote for `execute_office_js` throws an
138 error or Office rejects one of its calls, the add-in sends a record
139 for about one in a hundred of those failures.
140* A script that times out or that the add-in refuses to run sends a
141 record each time.
142
143A record can carry these attributes, in addition to the
144[resource attributes](#resource-attributes).
145
146| Attribute | Description |
147| - | - |
148| `component` | Part of the add-in that logged the record |
149| `tool_name` | Tool the record is about, when there is one. Unlike on spans, a connector tool appears as `mcp__<server>__<tool>`, not as `mcp_tool` |
150| `error_type`, `tool_error_type` | The add-in's error category and, for a tool, its failure class |
151| `exception.type` | The error's name, usually its class name |
152| `error_code` | Error code from Office or from the failed request, when there is one |
153| `http_status` | Status of a failed HTTP request, when there is one |
154| `stack_frames` | Up to three stack frames, each a function name, a script file or URL, and a line number, without the error message. By default the add-in cuts each URL down to its scheme, host, port, and path |
155| `reason`, `outcome`, `kind`, `attempts`, `count`, `cap` | Values that add detail to some messages, usually a fixed code or a count. A few hold a short phrase from the add-in's code. The `reason` of a skill that failed to load holds that error's text, and the `reason` of a settings document the add-in could not read can quote a value from that document |
156| `session_id` | Same value as `session.id` on spans |
157| `surface`, `vendor` | Same values as `agent.surface` and `agent.vendor` on spans |
158| `office.platform`, `office.host_detail` | The Office platform and, in Outlook, the Outlook client, when the add-in recorded them |
159
160A collector delivered by an administrator-managed settings document that
161does not select tool inputs, the `toolDetails` category, receives these
162records in a reduced form. The add-in replaces the server and tool parts
163of each connector tool name with hashes, so one tool always has the same
164value, and adds a `body.length` attribute that holds the length of the
165message.
166
79167## Endpoint requirements
80168
81169The add-in exports telemetry from each user's browser: the taskpane at
from line 203
115203### Direct-provider deployments
116204
117205Deployments that authenticate against Bedrock, Vertex AI, Foundry, or a
118gateway supply the same two keys through the customer-configuration
119channels described in
206gateway supply these keys through the customer-configuration channels
207described in
120208[Use Claude for M365 with third-party platforms](https://claude.com/docs/office-agents/third-party-platforms.md).
121209
122210| Key | Format | Description |
from line 211
123211| - | - | - |
124212| `otlp_endpoint` | HTTPS URL | Collector base URL. Trailing slashes are stripped |
125213| `otlp_headers` | `key1=value1,key2=value2` | Optional authentication headers |
214| `otlp_resource_attributes` | `key1=value1,key2=value2` | Optional attributes added to the resource of every span and log record. See [Label spans with resource attributes](#label-spans-with-resource-attributes) |
126215
127216The `claude-for-msft-365-install` setup plugin writes these for you. To
128217set them by hand, use either channel below. A value in the bootstrap
from line 225
136225custom manifest, with `otlp_headers` after `#` so the credential stays out of [server request logs](https://claude.com/docs/office-agents/third-party-platforms.md#keep-credentials-out-of-the-manifest-url-query-string).
137226
138227```text theme={null}
139https://pivot.claude.ai/taskpane.html?otlp_endpoint=https://otel-collector.example.com#otlp_headers=Authorization=Bearer%20<token>
228https://pivot.claude.ai/?otlp_endpoint=https://otel-collector.example.com#otlp_headers=Authorization=Bearer%20<token>
140229```
141230
142231**Bootstrap endpoint response.** Include the keys in the JSON body your
from line 238
149238}
150239```
151240
241### Label spans with resource attributes
242
243The `otlp_resource_attributes` configuration key adds attributes of your
244choice to the OpenTelemetry resource of every span and log record the
245add-in sends to your collector. Use it when your collector or tracing
246backend routes or filters on resource attributes, or to record which
247team or user a span belongs to.
248
249Set the key through a manifest, ID token claims, or a bootstrap
250endpoint, the channels that
251[Per-user configuration](https://claude.com/docs/office-agents/third-party-platforms.md#per-user-configuration)
252describes. The add-in ignores the key when users sign in with a Claude
253account. It then takes its collector settings from the Claude admin
254console or, for members who sign in through the
255[Enterprise Admin Console](https://claude.com/docs/office-agents/admin-console.md), from that
256console.
257
258Write the value as one string of comma-separated `key=value` pairs. A
259value cannot contain a comma, and the add-in ignores a pair with an empty
260key or value. In a bootstrap response or an ID token claim, the add-in
261uses each value as written and does not percent-decode it.
262
263If one of your keys is one the add-in already sets, such as
264`service.name`, your value replaces the add-in's.
265
266The add-in adds your attributes only to the spans and log records it
267sends to your collector. It does not add them to the metrics it sends to
268Anthropic.
269
270Use the manifest for a value shared by everyone. In the manifest URL,
271percent-encode any space, `&`, `#`, `+`, or `%` in a value.
272
273The browser sends a value after `?` to `pivot.claude.ai` each time the
274add-in loads, as
275[Keep credentials out of the manifest URL query string](https://claude.com/docs/office-agents/third-party-platforms.md#keep-credentials-out-of-the-manifest-url-query-string)
276explains. Put the key after `#` if a value names a person or team.
277
278The following taskpane URL adds the key to the URL already in a
279manifest and labels every user's spans with an environment. It writes
280`&` as `&`, as the manifest XML requires.
281
282```text theme={null}
283https://pivot.claude.ai/?gateway=1&m=excel3p-1.0.0.1&otlp_endpoint=https://otel-collector.example.com&otlp_resource_attributes=deployment.environment=prod
284```
285
286Use a bootstrap endpoint or a claim for a value that differs per user.
287With `entra_sso=1`, the add-in sends the user's Microsoft Entra token
288with each bootstrap request, so your endpoint can return a different
289value for each user or team. With
290[your own Entra app registration](https://claude.com/docs/office-agents/outlook.md#use-your-own-entra-app-instead),
291an ID token claim can also carry a per-user value.
292
293Unless members sign in through the Enterprise Admin Console, spans from
294a direct-provider deployment carry no Claude user identity. A per-user
295attribute is one way to attribute them to a user.
296
297The following bootstrap response labels one user's spans with that
298user's ID and team. The value must be a JSON string, not an object or an
299array.
300
301```json theme={null}
302{
303 "otlp_endpoint": "https://otel-collector.example.com",
305}
306```
307
152308### Attribute size cap
153309
154310Prompt, reply, tool-input, and tool-output attributes are truncated in
from line 318
162318
163319## Deployment modes
164320
165The audit trail differs slightly depending on the sign-in path.
321The audit trail differs slightly depending on the sign-in path. With
322either sign-in, each file a user attaches produces a `file.upload` span
323whenever your collector receives spans, and `agent.query` carries the
324MCP connection counts.
166325
167**Claude Enterprise (OAuth):** full audit trail including user identity
168(`user.email`, `user.account_uuid`, `organization.id`), MCP server
169metadata, and file-upload spans.
326The add-in takes the MCP connection counts once, when it finishes
327loading the connectors of the user's Claude account. They count every
328MCP server that is connected or has failed at that moment, including
329servers from your deployment's configuration. On a third-party platform
330connection, including one that your organization manages from the
331Enterprise Admin Console, the add-in does not load a Claude account's
332connectors, so the counts read 0 even while MCP servers from your
333deployment's configuration are connected.
170334
335**Claude Enterprise (OAuth):** prompts, tool inputs and outputs, and
336document URLs, plus user identity (`user.email`, `user.account_uuid`,
337`organization.id`).
338
171339**Direct provider (Bedrock, Vertex AI, Foundry, gateway):** core audit
172340trail with prompts, tool inputs and outputs, and document URLs. No
173Claude user identity, MCP metadata, or file-upload spans. Attribute
174activity to a user by correlating `session.id` against your identity
175provider or gateway logs.
341Claude user identity unless members sign in through the Enterprise Admin
342Console.
343[Reconstruct a user session](#reconstruct-a-user-session) describes how
344to attribute activity to a user.
176345
177346## Span reference
178347
179348Each user turn produces up to five span types. `agent.query` is the
180root; `agent.stream` and `agent.compaction` are its children;
181`agent.tool_execution` is a child of `agent.stream`; `file.upload`
349root, and `agent.stream` and `agent.compaction` are its children.
350`agent.tool_execution` is a child of `agent.stream`, or of `agent.query`
351when the tool starts after its model call has ended. `file.upload`
182352arrives as a separate root span. The four `agent.*` spans each carry
183353`agent.surface` (`sheet`, `doc`, `slide`, or `mail`), `agent.vendor`
184(`m` for Microsoft), and `session.id`, and with Claude sign-in
185`user.email`, `user.account_uuid`, and `organization.id`, so each
186can be filtered on its own. `file.upload` carries `session.id` and, with
187Claude sign-in, `user.email`; correlate it to a turn by `session.id` and
188timestamp, since it has its own trace ID. Attributes marked
189*content* carry user-generated data. Attributes marked *Claude sign-in
190only* are populated only when users sign in with a Claude account.
354(`m` for Microsoft), and `session.id`, and, with a Claude account or
355Claude for Government sign-in, `user.email`, `user.account_uuid`, and
356`organization.id`, so each can be filtered on its own. `file.upload`
357carries `session.id` and, with one of those sign-ins, `user.email`;
358correlate it to a turn by `session.id` and timestamp, since it has its
359own trace ID. Attributes marked *content* carry user-generated data.
360Attributes marked *Claude sign-in only* are populated only when users
361sign in with a Claude account or a Claude for Government sign-in.
362Members who sign in through the Enterprise Admin Console get only
363`user.email` and `user.account_uuid` of these, and Claude for Government
364sign-ins never get `org.rate_limit_tier`.
191365Attributes marked *managed settings document only* are sent only to a
192366collector delivered by an administrator-managed settings document, and
193367only when the administrator selected the attribute's category, as
from line 369
195369
196370### Resource attributes
197371
198These are set on every span.
372These are set on every span and log record. A deployment configured
373through a manifest, ID token claims, or a bootstrap endpoint can add its
374own with the
375[`otlp_resource_attributes` key](#label-spans-with-resource-attributes).
199376
200377| Attribute | Description |
201378| - | - |
from line 390
213390| `agent.vendor` | `m` |
214391| `user.message` *content* | User prompt, truncated per the attribute cap |
215392| `user.message_chars` | Pre-truncation length of the prompt |
216| `session.id` | Opaque session identifier |
393| `session.id` | Random identifier the add-in generates when the task pane loads. A new one replaces it when the chat is cleared, for example when the user starts a new chat, deletes all chats, or signs out. Opening an earlier chat from the history list keeps it, so one value can cover several chats |
217394| `document.url` *content* | URL of the open Office document |
218395| `agent.selected_model` | Model selected for the session |
219396| `office.platform` | `PC`, `Mac`, `OfficeOnline`, `iOS`, `Android`, or `Universal` |
from line 399
222399| `user.account_uuid` *Claude sign-in only* | Claude account UUID |
223400| `organization.id` *Claude sign-in only* | Claude organization UUID |
224401| `org.rate_limit_tier` *Claude sign-in only* | Subscription tier |
225| `mcp.configured_count` *Claude sign-in only* | Configured MCP servers |
226| `mcp.connected_count` *Claude sign-in only* | Connected MCP servers |
227| `mcp.failed_count` *Claude sign-in only* | Failed MCP connections |
228| `file.upload.count` *Claude sign-in only* | Files attached to the turn |
229| `file.upload.total_bytes` *Claude sign-in only* | Total uploaded bytes |
402| `mcp.configured_count` | MCP servers connected or failed when the add-in finished loading the connectors of the user's Claude account, including servers from your deployment's configuration. 0 on a third-party platform connection, including one managed from the Enterprise Admin Console |
403| `mcp.connected_count` | Of the servers in `mcp.configured_count`, those that were connected |
404| `mcp.failed_count` | Of the servers in `mcp.configured_count`, those that had failed to connect |
405| `file.upload.count` | Files attached to the turn |
406| `file.upload.total_bytes` | Total uploaded bytes |
230407| `error.name` | Exception class name, on failure |
231408| `agent.query_phase` | Phase at failure, on failure |
232409
from line 421
244421| `cache_read_tokens` | Tokens served from prompt cache |
245422| `cache_creation_tokens` | Tokens written to prompt cache |
246423| `stop_reason` | `end_turn`, `tool_use`, `max_tokens`, and similar |
247| `request_id` | Provider request ID for support correlation |
424| `request_id` | The `id` field of the message the provider returned for this call. It is not the `request-id` response header. Absent when the call fails |
248425| `response` *content, managed settings document only* | Text of Claude's reply (its text blocks), truncated per the attribute cap |
249426| `response_chars` *managed settings document only* | Full reply length in characters, sent with `response` |
250427| `error.name` | On failure, the exception class name (`APIUserAbortError` when the user stops the call; `Aborted` when the add-in abandons the call to retry it or because the conversation was reset) |
from line 432
255432
256433### agent.tool\_execution
257434
258One span per tool call, child of `agent.stream`. SpanKind `INTERNAL`.
259This is the primary record of what the model did to the document.
435At most one span per tool call. Its parent is the `agent.stream` span of
436the model call that requested the tool, or `agent.query` when the tool
437starts after that model call has ended. SpanKind `INTERNAL`. This is the
438primary record of what the model did to the document.
260439
261440| Attribute | Description |
262441| - | - |
from line 443
264443| `tool.id` | Unique invocation ID |
265444| `tool.caller` | `direct` for tools the add-in runs, or `server_tool` for tools the model provider runs |
266445| `tool.owner` | `first_party` for built-in tools, or `third_party` for MCP connector tools |
267| `tool.read_write` | `read` or `write` |
268| `tool.accept_decision` | `manual` (user approved this action), `auto_accept` (standing approval), or `deferred` (queued for review) |
446| `tool.read_write` | `read` or `write`. For `execute_office_js` and the other tools listed under `deferred` below, the value follows the permission mode and not what the tool does: `write` in "Ask before edits" and "Accept all edits" mode, `read` in "Skip all permissions" mode |
447| `tool.accept_decision` | Whether the add-in required the user's approval before it started the tool: `manual`, `auto_accept`, or `deferred`. Not set when `tool.caller` is `server_tool` |
269448| `tool.input` *content* | Serialized tool input, truncated per the attribute cap |
270449| `tool.success` | Boolean |
271450| `tool.output` *content* | Serialized tool output, truncated per the attribute cap |
272451| `tool.output_chars` | Full output length in characters |
273452| `tool.error_type` | Error classification, on failure |
274| `sheet.cells_read` | Cells read, sheet surface only |
275| `sheet.cells_written` | Cells written, sheet surface only |
276| `sheet.cells_copied` | Cells copied, sheet surface only |
277453
454The add-in sets `tool.accept_decision` when the tool starts. The value
455records whether the add-in required the user's approval at that moment.
456It does not record whether an approval card was shown, before or during
457the run, or what the user answered.
458
459* **manual**: the add-in required the user's approval before the tool
460 ran. If the user declined, or pressed Stop before answering, the span
461 carries `tool.success` `false` and `tool.error_type` `user_rejected`.
462* **auto\_accept**: the add-in required no approval when the tool started.
463 This is the value for most tools that only read, for most built-in
464 edit tools while the permission mode is "Accept all edits" or "Skip
465 all permissions", and for a connector tool after the user chose to
466 always allow that connector's tools.
467* **deferred**: the add-in required no approval when the tool started,
468 and the tool is one of six that the add-in does not hold for approval
469 before they start: `execute_office_js`, which runs a script Claude
470 wrote, `store_blob`, and Outlook's `present_draft_email`,
471 `present_draft_event`, `set_appointment_recurrence`, and
472 `update_writing_style`.
473
474Of the `deferred` tools, `execute_office_js` asks only if its script
475reaches a step that needs approval, for example a change to the document
476in "Ask before edits" mode or a mailbox search the user has not yet
477allowed, so it can finish without showing an approval card.
478`set_appointment_recurrence` and `update_writing_style` ask before they
479write. The other three never ask. When the user declines an approval
480card during the run, the call usually ends with `tool.success` `false`
481and `tool.error_type` `user_rejected`.
482
483The six tools are usually recorded as `deferred` in both "Ask before
484edits" and "Accept all edits" mode, whether or not they change anything.
485A script that only reads is `deferred` too. In "Skip all permissions"
486mode they are usually recorded as `auto_accept`. They can still ask
487there: `execute_office_js` before a mailbox search the user has not yet
488allowed or a step the add-in treats as a security risk, and
489`set_appointment_recurrence` and `update_writing_style` before they
490write.
491
492To see every script Claude ran, including the ones that changed the
493document, filter on `tool_name` `execute_office_js`. A filter or alert
494on `auto_accept` alone misses every script in the first two modes.
495
496`auto_accept` tools can ask during the run too. Examples are
497`update_instructions`, which changes the user's saved instructions, and
498`update_setting`, which changes a setting such as web search. When the
499user declines one of those changes, the span still carries
500`tool.success` `true`, and `tool.output` holds the outcome.
501
278502### agent.compaction
279503
280504One span per automatic conversation summarization when context nears
from line 517
293517### file.upload
294518
295519One span per uploaded file, emitted as its own root span rather than
296under `agent.query`. SpanKind `CLIENT`. Claude sign-in only. Also
297carries `session.id` and `user.email`. Correlate to the turn by
298`session.id` and timestamp.
520under `agent.query`. SpanKind `CLIENT`. Sent with either sign-in. Also
521carries `session.id` and, with a Claude account or Claude for Government
522sign-in, `user.email`. Correlate to the turn by `session.id` and
523timestamp.
299524
300525| Attribute | Description |
301526| - | - |
302527| `file.upload.size_bytes` | File size |
303528| `file.upload.mime_type` | MIME type |
304| `file.upload.file_id` | Anthropic Files API identifier |
529| `file.upload.file_id` | Anthropic Files API identifier. When the file stays in the add-in instead, `local_` followed by a random UUID. Absent when the upload fails |
305530| `file.upload.success` | Boolean |
306531
307532## Span events
from line 539
314539* `agent.compaction`: `compaction_start`, `compaction_complete`, `compaction_error`
315540* `file.upload`: `exception`
316541
317Every internal product counter also records a span event with the same
318name on the active span. For example, `office_agent.token.usage` is
319emitted on each `agent.stream` span with `token_usage.type` (`input`,
542One counter also appears as a span event. `office_agent.token.usage` is
543emitted on each `agent.stream` span whose call completes, once for each
544token type with a nonzero count, with `token_usage.type` (`input`,
320545`output`, `cacheRead`, or `cacheCreation`), `token_usage.model`, and
321`token_usage.token_count`.
546`token_usage.token_count`. A collector that receives only some content
547categories gets this event without its attributes. The same counts are
548on the `agent.stream` span as `input_tokens`, `output_tokens`,
549`cache_read_tokens`, and `cache_creation_tokens`.
322550
323Surface-specific events include `office_agent.cell_edit_collision_total`
324on Excel when a user is mid-edit while a tool writes, and the Word
325document-edit funnel (`office_agent.doc_edit_received_total`,
326`doc_edit_parsed_total`, `doc_edit_applied_total`,
327`doc_proposed_edit_reviewed_total`). PowerPoint and Outlook add no
328events beyond the common schema.
551The add-in's other counters, such as the Excel cell-edit collision count
552and the Word document-edit counts, are not sent to custom collectors and do
553not appear on spans.
329554
330555## Reconstruct a user session
331556
332The span tree produces a complete, ordered transcript in both deployment
333modes.
557The span tree produces an ordered record of each turn's prompt and of
558the tool calls that have `agent.tool_execution` spans, in both
559deployment modes. For the setups described under
560[Set up the collector](#set-up-the-collector), it does not include the
561text of Claude's replies. It also leaves out the clarifying questions
562that Claude asks the user with answer choices, and the user's answers.
334563
335564For Claude Enterprise deployments, filter `agent.query` spans by
336565`user.email` or `user.account_uuid` and `session.id`, order them by
from line 566
337566timestamp, and read `user.message` and `document.url` for each turn.
338567Then follow each `agent.query` span's trace ID to its
339568`agent.tool_execution` descendants, ordered by timestamp, to see what
340was attempted (`tool.input`), the result (`tool.output`), and how it was
341approved (`tool.accept_decision`).
569was attempted (`tool.input`), the result (`tool.output`), and whether
570the add-in required the user's approval before the tool started
571(`tool.accept_decision`).
342572
343573For direct-provider deployments, filter `agent.query` spans by
344`session.id` to isolate one session, use `document.url` to identify the
345file, and correlate the session against your Entra sign-in events,
346gateway access logs, or bootstrap endpoint logs to attribute it to a
347user. Per-turn reconstruction then follows the same trace-ID walk.
574`session.id` to isolate one session, and use `document.url` to identify
575the file. Per-turn reconstruction then follows the same trace-ID walk.
576
577Where users sign in with neither a Claude account nor a Claude for
578Government sign-in, the spans do not name the user. The add-in does not
579send `session.id` to your model provider,
580gateway, bootstrap endpoint, or identity provider, so their logs cannot
581be joined on it. The chat's model requests carry a different
582identifier: the `session_id` key inside `metadata.user_id` holds an ID
583the add-in keeps for each saved chat, which does not match
584`session.id`.
585
586To attribute a session to a user, take `request_id` from one of its
587completed `agent.stream` spans and look for the same message `id` in the
588logs of the service the add-in calls: your gateway, or your cloud
589provider when the add-in connects to it directly. The response is
590streamed, and the `id` arrives near the start of the stream, in the
591`message_start` event. This works only if those logs record that `id`
592and identify each user, which a gateway token shared by all users does
593not do by itself.
348594