DataDog / dd-trace-js

JavaScript APM Tracer
https://docs.datadoghq.com/tracing/
Other
655 stars 309 forks source link

How to disable OpenAI tracing? #4574

Open nikhilro opened 3 months ago

nikhilro commented 3 months ago

I'm getting this random error:

"message": "Cannot read properties of undefined (reading 'message')", "stack": "TypeError: Cannot read properties of undefined (reading 'message')\n at countCompletionTokens (/datadog-lib/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:369:30)\n at usageExtraction (/datadog-lib/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:759:35)\n at commonCreateResponseExtraction (/datadog-lib/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:698:3)\n at responseDataExtractionByMethod (/datadog-lib/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:461:7)\n at OpenApiPlugin.finish (/datadog-lib/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:242:5)\n at /datadog-lib/node_modules/dd-trace/packages/dd-trace/src/plugins/tracing.js:76:22\n at Subscription._handler (/datadog-lib/node_modules/dd-trace/packages/dd-trace/src/plugins/plugin.js:14:9)\n at Channel.publish (node:diagnostics_channel:143:9)\n at finish (/datadog-lib/node_modules/dd-trace/packages/datadog-instrumentations/src/openai.js:365:12)\n at /datadog-lib/node_modules/dd-trace/packages/datadog-instrumentations/src/openai.js:256:15"

I don't want OpenAI tracing. Please let me know how to disable.

juan-fernandez commented 3 months ago

hey @nikhilro !

You should be able to disable the plugin altogether with this env var:

DD_TRACE_DISABLED_PLUGINS=openai
DD_TRACE_DISABLED_INSTRUMENTATIONS=openai

Let us know if this solves your issue.

Also: could you give us any more info about how to reproduce this issue? So we can solve it for good 😄

nikhilro commented 3 months ago

Thanks!

No clue