Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function loadOpenAIInstrumentation () {

const stub = {
...realInstrument,
addHook (spec, cb) {
hookCallbacks.push({ spec, cb })
addHook (spec, hook) {
hookCallbacks.push({ spec, hook })
},
}

Expand All @@ -121,9 +121,9 @@ function loadOpenAIInstrumentation () {
}

function applyShim (hookCallbacks, filePath, targetClass, TargetClass) {
for (const { spec, cb } of hookCallbacks) {
for (const { spec, hook } of hookCallbacks) {
if (spec.file === `${filePath}.js`) {
cb({ [targetClass]: TargetClass })
hook({ [targetClass]: TargetClass })
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-grpc/test/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ describe('Plugin', () => {

it('should handle custom errors', async () => {
const client = await buildClient({
getUnary: (_, callback) => {
getUnary: (_, respond) => {
const metadata = new grpc.Metadata()

metadata.set('extra', 'information')

callback({ message: 'foobar', code: grpc.status.NOT_FOUND }, {}, metadata)
respond({ message: 'foobar', code: grpc.status.NOT_FOUND }, {}, metadata)
},
})

Expand Down
6 changes: 3 additions & 3 deletions packages/dd-trace/test/opentelemetry/logs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('OpenTelemetry Logs', () => {
let capturedPayload, capturedHeaders
let validatorCalled = false

sinon.stub(http, 'request').callsFake((options, callback) => {
sinon.stub(http, 'request').callsFake((options, onResponse) => {
// Only intercept OTLP logs requests
if (options.path && options.path.includes('/v1/logs')) {
capturedHeaders = options.headers
Expand All @@ -94,7 +94,7 @@ describe('OpenTelemetry Logs', () => {
once: () => {},
setTimeout: () => {},
}
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
return mockReq
}

Expand All @@ -106,7 +106,7 @@ describe('OpenTelemetry Logs', () => {
once: () => {},
setTimeout: () => {},
}
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
return mockReq
})

Expand Down
6 changes: 3 additions & 3 deletions packages/dd-trace/test/opentelemetry/traces.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('OpenTelemetry Traces', () => {
let capturedPayload, capturedHeaders
let validatorCalled = false

sinon.stub(http, 'request').callsFake((options, callback) => {
sinon.stub(http, 'request').callsFake((options, onResponse) => {
if (options.path && options.path.includes('/v1/traces')) {
capturedHeaders = options.headers
const mockReq = {
Expand All @@ -77,7 +77,7 @@ describe('OpenTelemetry Traces', () => {
once: () => {},
setTimeout: () => {},
}
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
return mockReq
}
const mockReq = {
Expand All @@ -87,7 +87,7 @@ describe('OpenTelemetry Traces', () => {
once: () => {},
setTimeout: () => {},
}
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
return mockReq
})

Expand Down
14 changes: 7 additions & 7 deletions packages/dd-trace/test/runtime_metrics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1090,12 +1090,12 @@ function loadOtlpRuntimeMetricsTestModule (overrides = {}) {
createObservableUpDownCounter: makeFactory('updowncounter'),
createObservableCounter: makeFactory('observable-counter'),
createHistogram: makeFactory('histogram'),
addBatchObservableCallback (cb, observables) {
batchCallbacks.push({ cb, observables })
addBatchObservableCallback (observeBatch, observables) {
batchCallbacks.push({ observeBatch, observables })
},
removeBatchObservableCallback (cb) {
const idx = batchCallbacks.findIndex(r => r.cb === cb)
if (idx !== -1) batchCallbacks.splice(idx, 1)
removeBatchObservableCallback (observeBatch) {
const index = batchCallbacks.findIndex(registration => registration.observeBatch === observeBatch)
if (index !== -1) batchCallbacks.splice(index, 1)
},
}

Expand Down Expand Up @@ -1129,9 +1129,9 @@ function loadOtlpRuntimeMetricsTestModule (overrides = {}) {

function fireBatchCallbacks () {
const observed = new Map()
for (const { cb, observables } of batchCallbacks) {
for (const { observeBatch, observables } of batchCallbacks) {
const allowed = new Set(observables)
cb({
observeBatch({
observe: (instrument, value, attrs = {}) => {
if (!allowed.has(instrument)) return
if (!observed.has(instrument)) observed.set(instrument, [])
Expand Down
Loading