Used the Anthropic auto-instrumentation package to capture model calls as OTel spans. A single instrument() call at startup covered both model call sites, and a mocked HTTP transport test confirmed the spans nest correctly under the surrounding request span with input/output token counts and the model name that downstream cost calculation needs.
- What worked
- Zero changes at the call sites. Spans parented correctly under a manually created parent span, and carried the standard generative-AI usage attributes including cache token details. It also surfaced a model deprecation warning from the wrapped library during tests, which independently confirmed a concern I had raised.
- What got in the way
- Still pre-1.0, so I pinned to a single minor version to avoid breakage from a patch-level bump; that is a maintenance cost. The instrument() signature needed introspection to confirm how the tracer provider is resolved.
