Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Updated instrumentation to use type constants instead of raw strings #2165

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/instrumentation/amqplib/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@

'use strict'
const amqplib = require('./amqplib')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

module.exports = [
{
moduleName: 'amqplib/callback_api',
type: 'message',
type: InstrumentationDescriptor.TYPE_MESSAGE,
onRequire: amqplib.instrumentCallbackAPI
},
{
moduleName: 'amqplib/channel_api',
type: 'message',
type: InstrumentationDescriptor.TYPE_MESSAGE,
onRequire: amqplib.instrumentPromiseAPI
}
]
7 changes: 4 additions & 3 deletions lib/instrumentation/grpc-js/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@

'use strict'
const grpc = require('./grpc')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

/**
* Need to use nr-hooks style for grpc because we're instrumentation a submodule.
*/
module.exports = [
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@grpc/grpc-js/build/src/resolving-call',
isEsm: true,
onRequire: grpc.wrapStartResolve
},
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@grpc/grpc-js/build/src/call-stream',
isEsm: true,
onRequire: grpc.wrapStartCall
},
{
type: 'web-framework',
type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK,
moduleName: '@grpc/grpc-js/build/src/server',
isEsm: true,
onRequire: grpc.wrapServer
Expand Down
9 changes: 5 additions & 4 deletions lib/instrumentation/langchain/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ const toolsInstrumentation = require('./tools')
const cbManagerInstrumentation = require('./callback-manager')
const runnableInstrumentation = require('./runnable')
const vectorstoreInstrumentation = require('./vectorstore')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

module.exports = [
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@langchain/core/tools',
onRequire: toolsInstrumentation
},
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@langchain/core/dist/callbacks/manager',
onRequire: cbManagerInstrumentation
},
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@langchain/core/dist/runnables/base',
onRequire: runnableInstrumentation
},
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: '@langchain/core/vectorstores',
onRequire: vectorstoreInstrumentation
}
Expand Down
7 changes: 4 additions & 3 deletions lib/instrumentation/mysql/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@

'use strict'
const instrumentation = require('./mysql')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

module.exports = [
{
type: 'datastore',
type: InstrumentationDescriptor.TYPE_DATASTORE,
moduleName: 'mysql',
onRequire: instrumentation.callbackInitialize
},
{
type: 'datastore',
type: InstrumentationDescriptor.TYPE_DATASTORE,
moduleName: 'mysql2',
onRequire: instrumentation.callbackInitialize
},
{
type: 'datastore',
type: InstrumentationDescriptor.TYPE_DATASTORE,
moduleName: 'mysql2/promise',
onRequire: instrumentation.promiseInitialize
}
Expand Down
3 changes: 2 additions & 1 deletion lib/instrumentation/pino/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

'use strict'
const pino = require('./pino')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

/**
* Need to use nr-hooks style because we are instrumenting a submodule.
*/
module.exports = [
{
type: 'generic',
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: 'pino/lib/tools',
onRequire: pino
}
Expand Down
3 changes: 2 additions & 1 deletion lib/instrumentation/when/nr-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

'use strict'
const instrumentation = require('./index')
const InstrumentationDescriptor = require('../../instrumentation-descriptor')

module.exports = [
{
type: null,
type: InstrumentationDescriptor.TYPE_GENERIC,
moduleName: 'when',
onRequire: instrumentation
}
Expand Down
Loading