Skip to content

Commit 2f05390

Browse files
committed
chore(eslint): update eslint-plugin-n and callback names
1 parent 9a2356d commit 2f05390

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

packages/datadog-instrumentations/test/openai-lifecycle.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ function loadOpenAIInstrumentation () {
101101

102102
const stub = {
103103
...realInstrument,
104-
addHook (spec, cb) {
105-
hookCallbacks.push({ spec, cb })
104+
addHook (spec, hook) {
105+
hookCallbacks.push({ spec, hook })
106106
},
107107
}
108108

@@ -121,9 +121,9 @@ function loadOpenAIInstrumentation () {
121121
}
122122

123123
function applyShim (hookCallbacks, filePath, targetClass, TargetClass) {
124-
for (const { spec, cb } of hookCallbacks) {
124+
for (const { spec, hook } of hookCallbacks) {
125125
if (spec.file === `${filePath}.js`) {
126-
cb({ [targetClass]: TargetClass })
126+
hook({ [targetClass]: TargetClass })
127127
return
128128
}
129129
}

packages/datadog-plugin-grpc/test/server.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ describe('Plugin', () => {
318318

319319
it('should handle custom errors', async () => {
320320
const client = await buildClient({
321-
getUnary: (_, callback) => {
321+
getUnary: (_, respond) => {
322322
const metadata = new grpc.Metadata()
323323

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

326-
callback({ message: 'foobar', code: grpc.status.NOT_FOUND }, {}, metadata)
326+
respond({ message: 'foobar', code: grpc.status.NOT_FOUND }, {}, metadata)
327327
},
328328
})
329329

packages/dd-trace/test/opentelemetry/logs.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('OpenTelemetry Logs', () => {
7171
let capturedPayload, capturedHeaders
7272
let validatorCalled = false
7373

74-
sinon.stub(http, 'request').callsFake((options, callback) => {
74+
sinon.stub(http, 'request').callsFake((options, onResponse) => {
7575
// Only intercept OTLP logs requests
7676
if (options.path && options.path.includes('/v1/logs')) {
7777
capturedHeaders = options.headers
@@ -93,7 +93,7 @@ describe('OpenTelemetry Logs', () => {
9393
once: () => {},
9494
setTimeout: () => {},
9595
}
96-
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
96+
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
9797
return mockReq
9898
}
9999

@@ -105,7 +105,7 @@ describe('OpenTelemetry Logs', () => {
105105
once: () => {},
106106
setTimeout: () => {},
107107
}
108-
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
108+
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
109109
return mockReq
110110
})
111111

packages/dd-trace/test/opentelemetry/traces.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('OpenTelemetry Traces', () => {
6363
let capturedPayload, capturedHeaders
6464
let validatorCalled = false
6565

66-
sinon.stub(http, 'request').callsFake((options, callback) => {
66+
sinon.stub(http, 'request').callsFake((options, onResponse) => {
6767
if (options.path && options.path.includes('/v1/traces')) {
6868
capturedHeaders = options.headers
6969
const mockReq = {
@@ -77,7 +77,7 @@ describe('OpenTelemetry Traces', () => {
7777
once: () => {},
7878
setTimeout: () => {},
7979
}
80-
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
80+
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
8181
return mockReq
8282
}
8383
const mockReq = {
@@ -87,7 +87,7 @@ describe('OpenTelemetry Traces', () => {
8787
once: () => {},
8888
setTimeout: () => {},
8989
}
90-
callback({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
90+
onResponse({ statusCode: 200, on: () => {}, once: () => {}, setTimeout: () => {} })
9191
return mockReq
9292
})
9393

packages/dd-trace/test/runtime_metrics.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,12 +1090,12 @@ function loadOtlpRuntimeMetricsTestModule (overrides = {}) {
10901090
createObservableUpDownCounter: makeFactory('updowncounter'),
10911091
createObservableCounter: makeFactory('observable-counter'),
10921092
createHistogram: makeFactory('histogram'),
1093-
addBatchObservableCallback (cb, observables) {
1094-
batchCallbacks.push({ cb, observables })
1093+
addBatchObservableCallback (observeBatch, observables) {
1094+
batchCallbacks.push({ observeBatch, observables })
10951095
},
1096-
removeBatchObservableCallback (cb) {
1097-
const idx = batchCallbacks.findIndex(r => r.cb === cb)
1098-
if (idx !== -1) batchCallbacks.splice(idx, 1)
1096+
removeBatchObservableCallback (observeBatch) {
1097+
const index = batchCallbacks.findIndex(registration => registration.observeBatch === observeBatch)
1098+
if (index !== -1) batchCallbacks.splice(index, 1)
10991099
},
11001100
}
11011101

@@ -1129,9 +1129,9 @@ function loadOtlpRuntimeMetricsTestModule (overrides = {}) {
11291129

11301130
function fireBatchCallbacks () {
11311131
const observed = new Map()
1132-
for (const { cb, observables } of batchCallbacks) {
1132+
for (const { observeBatch, observables } of batchCallbacks) {
11331133
const allowed = new Set(observables)
1134-
cb({
1134+
observeBatch({
11351135
observe: (instrument, value, attrs = {}) => {
11361136
if (!allowed.has(instrument)) return
11371137
if (!observed.has(instrument)) observed.set(instrument, [])

0 commit comments

Comments
 (0)