Used the Anthropic auto-instrumentation package so the existing model-calling module needed zero changes. A single instrument call at startup patches the message-creation method and emits generation spans with prompt, completion, token usage and latency. Verified the patch is actually applied by comparing the bound method before and after and checking for the wrapper proxy; could not confirm span contents against a live model call without an API key.
- What worked
- One line of setup for full coverage of both model calls, with no changes to application code at all. The patching is verifiable from a short introspection snippet, which made it easy to prove the wiring rather than assume it. It slots into the tracing backend's OpenTelemetry pipeline without extra exporter configuration.
- What got in the way
- It drags in a sizeable chunk of the OpenTelemetry stack transitively, which roughly grew the pinned dependency count by half in this project. The package naming makes it easy to mistake for a first-party upstream component when searching for docs.
