Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #144 from bizob2828/moar-shim-fixes
Browse files Browse the repository at this point in the history
updated tests to include shimName when registering instrumentation. also updated index.js to include shimName as that was missed from last time
  • Loading branch information
bizob2828 authored Apr 19, 2023
2 parents 80f4d7d + fa5b4af commit cacbb6b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
* then the supportability metrics for custom instrumentation will trigger.
*/
const newrelic = require('newrelic')
newrelic.instrumentWebframework('koa', require('./lib/instrumentation'))
newrelic.instrumentWebframework('koa-route', require('./lib/route-instrumentation'))
newrelic.instrumentWebframework('koa-router', require('./lib/router-instrumentation'))
newrelic.instrumentWebframework({
moduleName: 'koa',
onRequire: require('./lib/instrumentation'),
shimName: 'koa'
})
newrelic.instrumentWebframework({
moduleName: 'koa-route',
onRequire: require('./lib/route-instrumentation'),
shimName: 'koa'
})
newrelic.instrumentWebframework({
moduleName: 'koa-router',
onRequire: require('./lib/router-instrumentation'),
shimName: 'koa'
})
3 changes: 2 additions & 1 deletion tests/unit/koa.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ tap.test('Koa instrumentation', function (t) {
helper.registerInstrumentation({
moduleName: 'koa',
type: 'web-framework',
onRequire: require('../../lib/instrumentation')
onRequire: require('../../lib/instrumentation'),
shimName: 'koa'
})
const Koa = require('koa')
const shim = helper.getShim()
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/route.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ tap.test('koa-route', function (t) {
helper.registerInstrumentation({
type: 'web-framework',
moduleName: 'koa-route',
onRequire: require('../../lib/route-instrumentation.js')
onRequire: require('../../lib/route-instrumentation.js'),
shimName: 'koa'
})

const shim = helper.getShim()
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/router.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ koaRouterMods.forEach((koaRouterMod) => {
helper.registerInstrumentation({
type: 'web-framework',
moduleName: koaRouterMod,
onRequire: instrumentation
onRequire: instrumentation,
shimName: 'koa'
})

t.test('mounting paramware', function (t) {
Expand Down
9 changes: 6 additions & 3 deletions tests/versioned/code-level-metrics.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ async function setupApp({ useKoaRouter, useAtKoaRouter, isCLMEnabled }) {
helper.registerInstrumentation({
moduleName: 'koa',
type: 'web-framework',
onRequire: require('../../lib/instrumentation')
onRequire: require('../../lib/instrumentation'),
shimName: 'koa'
})

if (useKoaRouter) {
helper.registerInstrumentation({
moduleName: 'koa-router',
type: 'web-framework',
onRequire: require('../../lib/router-instrumentation')
onRequire: require('../../lib/router-instrumentation'),
shimName: 'koa'
})

const Router = require('koa-router')
Expand All @@ -54,7 +56,8 @@ async function setupApp({ useKoaRouter, useAtKoaRouter, isCLMEnabled }) {
helper.registerInstrumentation({
moduleName: '@koa/router',
type: 'web-framework',
onRequire: require('../../lib/router-instrumentation')
onRequire: require('../../lib/router-instrumentation'),
shimName: 'koa'
})
const Router = require('@koa/router')
router = new Router()
Expand Down
3 changes: 2 additions & 1 deletion tests/versioned/koa-v1.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ tap.test('Koa v1', function (t) {
helper.registerInstrumentation({
moduleName: 'koa',
type: 'web-framework',
onRequire: require('../../lib/instrumentation')
onRequire: require('../../lib/instrumentation'),
shimName: 'koa'
})
var koa = require('koa')
app = koa()
Expand Down
3 changes: 2 additions & 1 deletion tests/versioned/koa.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ tap.test('Koa instrumentation', (t) => {
helper.registerInstrumentation({
moduleName: 'koa',
type: 'web-framework',
onRequire: require('../../lib/instrumentation')
onRequire: require('../../lib/instrumentation'),
shimName: 'koa'
})
const Koa = require('koa')
app = new Koa()
Expand Down

0 comments on commit cacbb6b

Please sign in to comment.