diff --git a/test/benchmark/datastore-shim/shared.js b/test/benchmark/datastore-shim/shared.js index d97b58d4ba..3f057f031a 100644 --- a/test/benchmark/datastore-shim/shared.js +++ b/test/benchmark/datastore-shim/shared.js @@ -7,6 +7,7 @@ const benchmark = require('../../lib/benchmark') const DatastoreShim = require('../../../lib/shim/datastore-shim') +const { OperationSpec, QuerySpec } = require('../../../lib/shim/specs') const TestDatastore = require('./test-datastore') @@ -27,20 +28,32 @@ function getTestDatastore(agent, instrumented) { } }) - shim.recordOperation(testDatastore, 'testOp', { - name: 'testOp', - callback: shim.LAST - }) - - shim.recordQuery(testDatastore, 'testQuery', { - name: 'testQuery', - callback: shim.LAST - }) - - shim.recordBatchQuery(testDatastore, 'testBatch', { - name: 'testBatch', - callback: shim.LAST - }) + shim.recordOperation( + testDatastore, + 'testOp', + new OperationSpec({ + name: 'testOp', + callback: shim.LAST + }) + ) + + shim.recordQuery( + testDatastore, + 'testQuery', + new QuerySpec({ + name: 'testQuery', + callback: shim.LAST + }) + ) + + shim.recordBatchQuery( + testDatastore, + 'testBatch', + new QuerySpec({ + name: 'testBatch', + callback: shim.LAST + }) + ) } return testDatastore } diff --git a/test/benchmark/shim/record.bench.js b/test/benchmark/shim/record.bench.js index 175ec10286..f3ab8609be 100644 --- a/test/benchmark/shim/record.bench.js +++ b/test/benchmark/shim/record.bench.js @@ -8,6 +8,7 @@ const benchmark = require('../../lib/benchmark') const helper = require('../../lib/agent_helper') const Shim = require('../../../lib/shim/shim') +const { RecorderSpec } = require('../../../lib/shim/specs') const agent = helper.loadMockedAgent() const contextManager = helper.getContextManager() @@ -34,7 +35,7 @@ suite.add({ }) const wrapped = shim.record(getTest(), 'func', function () { - return { name: 'foo', callback: shim.LAST } + return new RecorderSpec({ name: 'foo', callback: shim.LAST }) }) suite.add({ diff --git a/test/benchmark/shim/row-callbacks.bench.js b/test/benchmark/shim/row-callbacks.bench.js index 21c3f2664b..098f51eb56 100644 --- a/test/benchmark/shim/row-callbacks.bench.js +++ b/test/benchmark/shim/row-callbacks.bench.js @@ -9,6 +9,7 @@ const benchmark = require('../../lib/benchmark') const EventEmitter = require('events').EventEmitter const helper = require('../../lib/agent_helper') const Shim = require('../../../lib/shim/shim') +const { RecorderSpec } = require('../../../lib/shim/specs') const CYCLES = 1000 @@ -28,7 +29,7 @@ const test = { } } shim.record(test, 'streamWrapped', function () { - return { name: 'streamer', stream: 'foo' } + return new RecorderSpec({ name: 'streamer', stream: 'foo' }) }) suite.add({ diff --git a/test/benchmark/shim/segments.bench.js b/test/benchmark/shim/segments.bench.js index 549fe34019..3905e6b216 100644 --- a/test/benchmark/shim/segments.bench.js +++ b/test/benchmark/shim/segments.bench.js @@ -5,6 +5,7 @@ 'use strict' +const { RecorderSpec } = require('../../../lib/shim/specs') const helper = require('../../lib/agent_helper') const shared = require('./shared') @@ -30,7 +31,7 @@ suite.add({ fn: function () { const test = shared.getTest() shim.record(test, 'func', function (shim, fn, name, args) { - return { name: name, args: args } + return new RecorderSpec({ name: name, args: args }) }) return test } diff --git a/test/benchmark/webframework-shim/recordMiddleware.bench.js b/test/benchmark/webframework-shim/recordMiddleware.bench.js index 31dbb717e8..63fbb10897 100644 --- a/test/benchmark/webframework-shim/recordMiddleware.bench.js +++ b/test/benchmark/webframework-shim/recordMiddleware.bench.js @@ -13,6 +13,7 @@ const symbols = require('../../../lib/symbols') const agent = helper.loadMockedAgent() const contextManager = helper.getContextManager() const shim = new WebFrameworkShim(agent, 'test-module', './') +const { MiddlewareSpec } = require('../../../lib/shim/specs') const suite = benchmark.createBenchmark({ name: 'recordMiddleware' }) const transaction = helper.runInTransaction(agent, function (tx) { @@ -93,18 +94,18 @@ function getReqd() { } function implicitSpec() { - return {} + return new MiddlewareSpec({}) } function partialSpec() { - return { + return new MiddlewareSpec({ next: shim.LAST, req: shim.FIRST - } + }) } function explicitSpec() { - return { + return new MiddlewareSpec({ req: shim.FIRST, res: shim.SECOND, next: shim.LAST, @@ -112,7 +113,7 @@ function explicitSpec() { params: function (shim, fn, name, args) { return args[0].params } - } + }) } function randomSpec() { @@ -144,7 +145,7 @@ function noop() {} function preOptRecordMiddleware() { for (let i = 0; i < 1000; ++i) { - let m = randomRecord(randomSpec) + let m = randomRecord(randomSpec()) m = typeof m === 'function' ? m : m.func for (let j = 0; j < 100; ++j) { m(getReqd(), {}, noop)