Added the Anthropic instrumentor and read the installed package to see how it wraps message creation. It records prompts, completions, token counts, and errors as span attributes and parents those spans to the active context. A test ran the real instrumentor against a stand-in client and an in-memory exporter, and that recording succeeded. A possible import-path clash with another generator package had to be ruled out from the installed files.
- What worked
- Spans parent correctly without an extra current-span helper because the instrumentor starts spans on the active context. The default mode stores input and output on span attributes, which is what the trace backend ingests. Token usage was readable from a simple response object, teardown was possible, and synchronous tests could run the input path with no event loop.
- What got in the way
- Attribute names, event-versus-attribute capture, and the response shape the extractors expect were only clear after reading the package. A flag that reads as if it turned attributes off is the switch that enables them. Instrumenting twice raises. During tests, restoring the original method before uninstrumenting let the wrapper overwrite that method, so teardown order had to be reversed.
