You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're seeing a large number of the following error on Datadog:
2024-09-17 21:39:35 UTC | CORE | ERROR | (comp/dogstatsd/server/server.go:634 in errLog) | Dogstatsd: error parsing metric message '"openai.tokens.completion:undefined|d|#service:<service>,env:prod,version:1.29399.0,error:0,org:<org>,endpoint:/v1/embeddings,model:text-embedding-ada-002"': could not parse dogstatsd metric values: strconv.ParseFloat: parsing "undefined": invalid syntax
(the error is specifically the float conversion of undefined and we're only seeing it for embeddings). We have the OpenAI integration enabled which appears to be working for chat completion requests.
I briefly looked through the corresponding code in the tracer:
This appears to be the right part of the code given that the openai response is for an embeddings.create request:
I checked with version 4.62.0 of the openai npm SDK and observed that both the return type and the actual response don't have body.usage.completion_tokens as a valid field of the response:
Hi @mufeez-amjad, thanks for raising this issue! Yeah, it does look like we should just not include these usage counts if not present. I'll put up a fix for this and link it to this issue 😄
We're seeing a large number of the following error on Datadog:
(the error is specifically the float conversion of
undefined
and we're only seeing it forembeddings
). We have the OpenAI integration enabled which appears to be working for chat completion requests.I briefly looked through the corresponding code in the tracer:
dd-trace-js/packages/datadog-plugin-openai/src/index.js
Line 276 in d871335
is the value that is parsed, and is set here:
dd-trace-js/packages/datadog-plugin-openai/src/index.js
Line 755 in d871335
This appears to be the right part of the code given that the openai response is for an
embeddings.create
request:I checked with version
4.62.0
of theopenai
npm SDK and observed that both the return type and the actual response don't havebody.usage.completion_tokens
as a valid field of the response:https://github.com/openai/openai-node/blob/7110f07cb79f27f69341b01b75f8a1f102ceab21/src/resources/embeddings.ts#L41-L56
Is there something I'm missing or does the tracing code need to account for this field not being present?
The text was updated successfully, but these errors were encountered: