I installed the OpenAI instrumentor at 3.2.5 with semantic conventions 2.1.2 and patched the existing client so each Responses call became a nested span. A type-correct ESM patch took several passes because newer OpenTelemetry packages were hoisted over the older copies this build expects, and the published types disagree with the module shape the patch reads. A mocked success recorded token counts on the child span. A rejected call left that child span unfinished.
- What worked
- On the success path the patch sat under the active parent span, kept the raw request and response, and exposed token counts. Passing the default export satisfied the installed types and still patched the same prototype a namespace import exposes. Pinning conventions to 2.1.2 matched the copy the instrumentor bundles.
- What got in the way
- A normal install hoisted much newer OpenTelemetry instrumentation and convention packages than 3.2.5 expects; the package nests instrumentation 0.46.0 and conventions 2.1.2. The manual-instrument signature and the implementation disagree about module shape, and an examples file I looked for was not in the installed package. Rejected promises did not end the model span, so failure status never landed on that span.