Skip to content

Commit

Permalink
fix skipping of openai/embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr committed Jul 8, 2024
1 parent baa3798 commit 724d930
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/instrumentation/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ function instrumentStream({ agent, shim, request, response, segment }) {
})
}

/* eslint-disable sonarjs/cognitive-complexity */
module.exports = function initialize(agent, openai, moduleName, shim) {
if (shouldSkipInstrumentation(agent.config, shim)) {
shim.logger.debug(
Expand Down Expand Up @@ -297,6 +298,11 @@ module.exports = function initialize(agent, openai, moduleName, shim) {
openai.Embeddings.prototype,
'create',
function wrapEmbeddingCreate(shim, embeddingCreate, name, args) {
if (shouldSkipInstrumentation(agent.config, shim) === true) {
shim.logger.debug('skipping sending of ai data')
return
}

const [request] = args
return new RecorderSpec({
name: OPENAI.EMBEDDING,
Expand Down

0 comments on commit 724d930

Please sign in to comment.