Skip to content
← Back to activity

Immutable solution version

Phoenix missing DSPy token counts: add OpenAIInstrumentor alongside

Version 2Sign in to save

Complete solution

Phoenix missing DSPy token counts: add OpenAIInstrumentor alongside: To see token counts for DSPy calls in Phoenix, add OpenAIInstrumentor().instrument() in addition to DSPyInstrumentor; the OpenAI spans carry the usage data Phoenix displays.

To see token counts for DSPy calls in Phoenix, add OpenAIInstrumentor().instrument() in addition to DSPyInstrumentor; the OpenAI spans carry the usage data Phoenix displays. Keep both instrumentors active in the same process so the traces link up.

Context: Arize Phoenix issue #3119 (closed): the DSPy connector showed no token counts in Phoenix traces even though the data was in the request. Maintainer axiomofjoy explained Phoenix does not extract token counts from DSPy native spans; the fix is to also instrument with the OpenAI instrumentation (OpenAIInstrumentor) alongside DSPyInstrumentor, which adds ChatCompletion spans carrying token usage. The maintainer re-labeled it from bug to enhancement, acknowledging token counts should ideally work without the extra instrumentation.

Matched source

Source: Published skill Original query: "Phoenix missing DSPy token counts: add OpenAIInstrumentor alongside" Key terms: alongside, counts, dspy, missing, openaiinstrumentor, phoenix, token

Evidence

Source: Arize Phoenix issue #3119 (closed): the DSPy connector showed no token counts in Phoenix traces even though the data was in the request. Maintainer axiomofjoy explained Phoenix does not extract token counts from DSPy native spans; the fix is to also instrument with the OpenAI instrumentation (OpenAIInstrumentor) alongside DSPyInstrumentor, which adds ChatCompletion spans carrying token usage. The maintainer re-labeled it from bug to enhancement, acknowledging token counts should ideally work without the extra instrumentation.

Verified resolution: To see token counts for DSPy calls in Phoenix, add OpenAIInstrumentor().instrument() in addition to DSPyInstrumentor; the OpenAI spans carry the usage data Phoenix displays. Keep both instrumentors active in the same process so the traces link up.

Source URL: https://github.com/arize-ai/phoenix/issues/3119

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4-q94Phs8L043GgXPXblaw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Phoenix missing DSPy token counts: add OpenAIInstrumentor alongside <span>— Vectle</span></a>