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

fix: correct dev-deps required for the recent eslint@8 upgrade #3449

Merged
merged 5 commits into from
Jul 4, 2023
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
6 changes: 1 addition & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
"/test/types/transpile/index.js",
"/test/types/transpile-default/index.js",
"/test_output",
"tmp",
// These files use top-level await, which is *fine* for ESM files but, IIUC,
// not supported by eslint until v8.
"/test/instrumentation/modules/fixtures/use-fastify.mjs",
"/test/instrumentation/modules/http/fixtures/use-dynamic-import.mjs"
"tmp"
]
}
2 changes: 1 addition & 1 deletion dev-utils/bitrot.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const options = [
]

function main (argv) {
var parser = dashdash.createParser({ options: options })
var parser = dashdash.createParser({ options })
try {
var opts = parser.parse(argv)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ Agent.prototype.captureError = function (err, opts, cb) {

errors.createAPMError({
log: agent.logger,
id: id,
id,
exception: errIsError ? err : null,
logMessage: errIsError ? null : err,
shouldCaptureAttributes,
Expand Down
4 changes: 2 additions & 2 deletions lib/http-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ function main (argv) {
const timeout = Number(argv[4])

var req = httpRequest(url, {
timeout: timeout,
connectTimeout: connectTimeout
timeout,
connectTimeout
// TODO: log support
}, function onRes (res) {
res.pipe(process.stdout)
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/dropped-spans-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class DroppedSpansStats {
}
},
destination_service_resource: resource,
outcome: outcome
outcome
}
if (serviceTargetType) {
stats.service_target_type = serviceTargetType
Expand Down
14 changes: 7 additions & 7 deletions lib/instrumentation/http-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ exports.instrumentRequest = function (agent, moduleName) {
const tracestate = req.headers.tracestate
const trans = agent.startTransaction(null, null, {
childOf: traceparent,
tracestate: tracestate
tracestate
})
trans.type = 'request'
trans.req = req
Expand Down Expand Up @@ -186,7 +186,7 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
const parentRunContext = ins.currRunContext()
var span = ins.createSpan(null, 'external', 'http', { exitSpan: true })
var id = span && span.transaction.id
agent.logger.debug('intercepted call to %s.%s %o', moduleName, method, { id: id })
agent.logger.debug('intercepted call to %s.%s %o', moduleName, method, { id })

// Reproduce the argument handling from node/lib/_http_client.js#ClientRequest().
//
Expand Down Expand Up @@ -261,7 +261,7 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
var req = ins.withRunContext(spanRunContext, orig, this, ...newArgs)

var protocol = req.agent && req.agent.protocol
agent.logger.debug('request details: %o', { protocol: protocol, host: getSafeHost(req), id: id })
agent.logger.debug('request details: %o', { protocol, host: getSafeHost(req), id })

ins.bindEmitter(req)

Expand All @@ -280,15 +280,15 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {

const url = getUrlFromRequestAndOptions(req, options, moduleName + ':')
if (!url) {
agent.logger.warn('unable to identify http.ClientRequest url %o', { id: id })
agent.logger.warn('unable to identify http.ClientRequest url %o', { id })
}
let statusCode
return req

// In case the request is ended prematurely
function onAbort (type) {
if (span.ended) return
agent.logger.debug('intercepted http.ClientRequest abort event %o', { id: id })
agent.logger.debug('intercepted http.ClientRequest abort event %o', { id })

onEnd()
}
Expand Down Expand Up @@ -319,11 +319,11 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
}

function onResponse (res) {
agent.logger.debug('intercepted http.ClientRequest response event %o', { id: id })
agent.logger.debug('intercepted http.ClientRequest response event %o', { id })
ins.bindEmitterToRunContext(parentRunContext, res)
statusCode = res.statusCode
res.prependListener('end', function () {
agent.logger.debug('intercepted http.IncomingMessage end event %o', { id: id })
agent.logger.debug('intercepted http.IncomingMessage end event %o', { id })
onEnd()
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/modules/@aws-sdk/client-s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function s3MiddlewareFactory (client, agent) {
context[elasticAPMStash] = {
protocol: req.protocol,
hostname: req.hostname,
port: port
port
}
return next(args)
},
Expand Down
6 changes: 3 additions & 3 deletions lib/instrumentation/modules/elasticsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
var method = params && params.method
var path = params && params.path

agent.logger.debug('intercepted call to elasticsearch.Transport.prototype.request %o', { id: id, method: method, path: path })
agent.logger.debug('intercepted call to elasticsearch.Transport.prototype.request %o', { id, method, path })

if (span && method && path) {
span.name = `Elasticsearch: ${method} ${path}`
Expand Down Expand Up @@ -145,7 +145,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
shimmer.wrap(inspectedPromise, 'abort', function wrapAbort (originalAbort) {
return function wrappedAbort () {
if (span.ended) return
agent.logger.debug('intercepted call to elasticsearch.Transport.request.abort %o', { id: id, method: method, path: path })
agent.logger.debug('intercepted call to elasticsearch.Transport.request.abort %o', { id, method, path })
const originalReturn = originalAbort.apply(this, args)
span.end()
return originalReturn
Expand All @@ -155,7 +155,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
return inspectedPromise
}
} else {
agent.logger.debug('could not instrument elasticsearch request %o', { id: id })
agent.logger.debug('could not instrument elasticsearch request %o', { id })
return original.apply(this, arguments)
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/instrumentation/modules/generic-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (generic, agent, { version }) {
return function wrappedPool () {
var trans = agent._instrumentation.currTransaction()
var id = trans && trans.id
agent.logger.debug('intercepted call to generic-pool.Pool %o', { id: id })
agent.logger.debug('intercepted call to generic-pool.Pool %o', { id })

var pool
if (this instanceof generic.Pool) {
Expand All @@ -32,7 +32,7 @@ module.exports = function (generic, agent, { version }) {
return function wrappedAcquire () {
var trans = agent._instrumentation.currTransaction()
var id = trans && trans.id
agent.logger.debug('intercepted call to pool.acquire %o', { id: id })
agent.logger.debug('intercepted call to pool.acquire %o', { id })

var cb = arguments[0]
if (typeof cb === 'function') {
Expand All @@ -59,7 +59,7 @@ module.exports = function (generic, agent, { version }) {
return function wrappedEnqueue () {
var trans = agent._instrumentation.currTransaction()
var id = trans && trans.id
agent.logger.debug('intercepted call to generic-pool.PriorityQueue.prototype.enqueue %o', { id: id })
agent.logger.debug('intercepted call to generic-pool.PriorityQueue.prototype.enqueue %o', { id })

var obj = arguments[0]
// Expect obj to of type Deferred
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/modules/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ module.exports = function (graphql, agent, { version, enabled }) {
agent.logger.debug('unexpected document format - skipping graphql query extraction')
}

return { queries: queries, operation: operation }
return { queries, operation }
}
}
2 changes: 1 addition & 1 deletion lib/instrumentation/modules/http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module.exports = function (http2, agent, { enabled }) {
var tracestate = req.headers.tracestate
const trans = agent.startTransaction(null, null, {
childOf: traceparent,
tracestate: tracestate
tracestate
})
trans.type = 'request'
trans.req = req
Expand Down
12 changes: 6 additions & 6 deletions lib/instrumentation/modules/mongodb-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
var id = trans && trans.id
var span

agent.logger.debug('intercepted call to mongodb-core.Server.prototype.command %o', { id: id, ns: ns })
agent.logger.debug('intercepted call to mongodb-core.Server.prototype.command %o', { id, ns })

if (trans && arguments.length > 0) {
var index = arguments.length - 1
Expand All @@ -69,7 +69,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
return orig.apply(this, arguments)

function wrappedCallback (_err, commandResult) {
agent.logger.debug('intercepted mongodb-core.Server.prototype.command callback %o', { id: id })
agent.logger.debug('intercepted mongodb-core.Server.prototype.command callback %o', { id })
if (commandResult && commandResult.connection) {
span._setDestinationContext(getDBDestination(
commandResult.connection.host, commandResult.connection.port))
Expand All @@ -86,7 +86,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
var id = trans && trans.id
var span

agent.logger.debug('intercepted call to mongodb-core.Server.prototype.%s %o', name, { id: id, ns: ns })
agent.logger.debug('intercepted call to mongodb-core.Server.prototype.%s %o', name, { id, ns })

if (trans && arguments.length > 0) {
var index = arguments.length - 1
Expand All @@ -103,7 +103,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
return orig.apply(this, arguments)

function wrappedCallback (_err, commandResult) {
agent.logger.debug('intercepted mongodb-core.Server.prototype.%s callback %o', name, { id: id })
agent.logger.debug('intercepted mongodb-core.Server.prototype.%s callback %o', name, { id })
if (commandResult && commandResult.connection) {
span._setDestinationContext(getDBDestination(
commandResult.connection.host, commandResult.connection.port))
Expand All @@ -119,7 +119,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
var id = trans && trans.id
var span

agent.logger.debug('intercepted call to mongodb-core.Cursor.prototype.%s %o', name, { id: id })
agent.logger.debug('intercepted call to mongodb-core.Cursor.prototype.%s %o', name, { id })

if (trans && arguments.length > 0) {
var cb = arguments[0]
Expand All @@ -143,7 +143,7 @@ module.exports = function (mongodb, agent, { version, enabled }) {
return orig.apply(this, arguments)

function wrappedCallback () {
agent.logger.debug('intercepted mongodb-core.Cursor.prototype.%s callback %o', name, { id: id })
agent.logger.debug('intercepted mongodb-core.Cursor.prototype.%s callback %o', name, { id })
span.end()
return cb.apply(this, arguments)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/modules/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function (mysql, agent, { version, enabled }) {
var cb = arguments[0]

if (typeof cb === 'function') {
arguments[0] = agent._instrumentation.bindFunction(function wrapedCallback (err, connection) { // eslint-disable-line node/handle-callback-err
arguments[0] = agent._instrumentation.bindFunction(function wrapedCallback (err, connection) { // eslint-disable-line n/handle-callback-err
if (connection) wrapQueryable(connection, 'getConnection() > connection', agent)
return cb.apply(this, arguments)
})
Expand Down
4 changes: 2 additions & 2 deletions lib/instrumentation/modules/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = function (redis, agent, { version, enabled }) {
}

const command = commandObj.command
agent.logger.debug({ command: command }, 'intercepted call to RedisClient.prototype.internal_send_command')
agent.logger.debug({ command }, 'intercepted call to RedisClient.prototype.internal_send_command')
const span = ins.createSpan(command.toUpperCase(), TYPE, SUBTYPE, ACTION, { exitSpan: true })
if (!span) {
return original.apply(this, arguments)
Expand Down Expand Up @@ -112,7 +112,7 @@ module.exports = function (redis, agent, { version, enabled }) {
return original.apply(this, arguments)
}

agent.logger.debug({ command: command }, 'intercepted call to RedisClient.prototype.send_command')
agent.logger.debug({ command }, 'intercepted call to RedisClient.prototype.send_command')
var span = ins.createSpan(command.toUpperCase(), TYPE, SUBTYPE, ACTION, { exitSpan: true })
if (!span) {
return original.apply(this, arguments)
Expand Down
4 changes: 2 additions & 2 deletions lib/instrumentation/patch-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ module.exports = function (ins) {
}

// only wrap lchown and lchmod on systems that have them.
if (fs.lchown) wrap(fs, 'lchown', activator) // eslint-disable-line node/no-deprecated-api
if (fs.lchmod) wrap(fs, 'lchmod', activator) // eslint-disable-line node/no-deprecated-api
if (fs.lchown) wrap(fs, 'lchown', activator) // eslint-disable-line n/no-deprecated-api
if (fs.lchmod) wrap(fs, 'lchmod', activator) // eslint-disable-line n/no-deprecated-api

// only wrap ftruncate in versions of node that have it
if (fs.ftruncate) wrap(fs, 'ftruncate', activator)
Expand Down
8 changes: 4 additions & 4 deletions lib/instrumentation/template-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exports.wrapCompile = function (agent, moduleName) {
var id = span && span.transaction.id

agent.logger.debug('intercepted call to %s render %o', moduleName, {
id: id,
data: data
id,
data
})

var ret = original.apply(this, arguments)
Expand All @@ -30,8 +30,8 @@ exports.wrapCompile = function (agent, moduleName) {
var id = span && span.transaction.id

agent.logger.debug('intercepted call to %s compile %o', moduleName, {
id: id,
input: input
id,
input
})

var ret = original.apply(this, arguments)
Expand Down
4 changes: 2 additions & 2 deletions lib/instrumentation/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Object.defineProperty(Transaction.prototype, 'name', {
this._agent.logger.debug('tried to set transaction.name on already ended transaction %o', { trans: this.id, parent: this.parentId, trace: this.traceId })
return
}
this._agent.logger.debug('setting transaction name %o', { trans: this.id, parent: this.parentId, trace: this.traceId, name: name })
this._agent.logger.debug('setting transaction name %o', { trans: this.id, parent: this.parentId, trace: this.traceId, name })
this._customName = name
}
})
Expand All @@ -136,7 +136,7 @@ Object.defineProperty(Transaction.prototype, 'result', {
this._agent.logger.debug('tried to set transaction.result on already ended transaction %o', { trans: this.id, parent: this.parentId, trace: this.traceId })
return
}
this._agent.logger.debug('setting transaction result %o', { trans: this.id, parent: this.parentId, trace: this.traceId, result: result })
this._agent.logger.debug('setting transaction result %o', { trans: this.id, parent: this.parentId, trace: this.traceId, result })
this._result = result
}
})
Expand Down
4 changes: 2 additions & 2 deletions lib/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ function setSnsData (agent, trans, event, context, faasId, isColdStart) {
const cloudContext = {
origin: {
provider: 'aws',
region: region,
region,
service: {
name: 'sns'
},
Expand Down Expand Up @@ -625,7 +625,7 @@ function elasticApmAwsLambda (agent) {
// Start the transaction and set some possibly trigger-specific data.
const trans = agent.startTransaction(context.functionName, type, {
childOf: traceparent,
tracestate: tracestate
tracestate
})
switch (triggerType) {
case TRIGGER_API_GATEWAY:
Expand Down
12 changes: 6 additions & 6 deletions lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function createLogger (levelName, customLogger) {
}

return customLogger.child({
serializers: serializers
serializers
})
}

Expand All @@ -150,7 +150,7 @@ function createLogger (levelName, customLogger) {
name: 'elastic-apm-node',
base: {}, // Don't want pid and hostname fields.
level: pinoLevel,
serializers: serializers,
serializers,
...ecsFormat({ apmIntegration: false })
}, dest)

Expand All @@ -175,8 +175,8 @@ function setLogLevel (logger, levelName) {
}

module.exports = {
DEFAULT_LOG_LEVEL: DEFAULT_LOG_LEVEL,
createLogger: createLogger,
isLoggerCustom: isLoggerCustom,
setLogLevel: setLogLevel
DEFAULT_LOG_LEVEL,
createLogger,
isLoggerCustom,
setLogLevel
}
4 changes: 2 additions & 2 deletions lib/stacktraces.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function frameFromCallSite (log, callsite, cwd, sourceLinesAppFrames, sourceLine
let mappedLineno = null

if (sourceMapErr) {
log.debug({ filename: filename, err: sourceMapErr },
log.debug({ filename, err: sourceMapErr },
'could not process file source map')
} else if (sourceMapConsumer) {
let pos
Expand All @@ -316,7 +316,7 @@ function frameFromCallSite (log, callsite, cwd, sourceLinesAppFrames, sourceLine
column: callsite.getColumnNumber()
})
} catch (posErr) {
log.debug({ filename: filename, line: lineno, err: sourceMapErr },
log.debug({ filename, line: lineno, err: sourceMapErr },
'could not get position from sourcemap')
pos = {
source: null,
Expand Down
Loading