newrelic 13.3.2 → 13.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/NEWS.md +43 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -11
  3. package/esm-loader.mjs +2 -2
  4. package/lib/attributes.js +4 -4
  5. package/lib/collector/facts.js +1 -1
  6. package/lib/collector/http-agents.js +2 -2
  7. package/lib/collector/parse-response.js +9 -12
  8. package/lib/collector/remote-method.js +4 -5
  9. package/lib/config/formatters.js +2 -3
  10. package/lib/config/index.js +6 -6
  11. package/lib/harvester.js +1 -1
  12. package/lib/header-processing.js +3 -3
  13. package/lib/instrumentation/@node-redis/client.js +1 -1
  14. package/lib/instrumentation/aws-sdk/v2/instrumentation-helper.js +2 -2
  15. package/lib/instrumentation/aws-sdk/v3/common.js +5 -5
  16. package/lib/instrumentation/aws-sdk/v3/dynamodb.js +4 -4
  17. package/lib/instrumentation/aws-sdk/v3/sns.js +9 -9
  18. package/lib/instrumentation/aws-sdk/v3/sqs.js +6 -6
  19. package/lib/instrumentation/core/http-outbound.js +1 -2
  20. package/lib/instrumentation/fastify/spec-builders.js +11 -11
  21. package/lib/instrumentation/fastify.js +4 -4
  22. package/lib/instrumentation/memcached.js +4 -4
  23. package/lib/instrumentation/mongodb.js +2 -2
  24. package/lib/instrumentation/undici.js +3 -3
  25. package/lib/instrumentations.js +0 -2
  26. package/lib/llm-events/aws-bedrock/bedrock-response.js +6 -6
  27. package/lib/llm-events/aws-bedrock/converse-stream-handler.js +1 -1
  28. package/lib/llm-events/aws-bedrock/stream-handler.js +4 -4
  29. package/lib/metrics/index.js +2 -2
  30. package/lib/metrics/normalizer/rule.js +1 -1
  31. package/lib/metrics/normalizer.js +4 -5
  32. package/lib/metrics/recorders/message-transaction.js +3 -3
  33. package/lib/otel/context-manager.js +4 -4
  34. package/lib/otel/metrics/index.js +3 -3
  35. package/lib/otel/setup.js +6 -0
  36. package/lib/otel/trace-propagator.js +1 -1
  37. package/lib/otel/traces/index.js +1 -1
  38. package/lib/prioritized-attributes.js +2 -2
  39. package/lib/serverless/aws-lambda.js +4 -4
  40. package/lib/shim/datastore-shim.js +1 -1
  41. package/lib/shim/message-shim/consume.js +1 -1
  42. package/lib/shim/message-shim/subscribe-consume.js +1 -2
  43. package/lib/shim/promise-shim.js +1 -3
  44. package/lib/shim/shim.js +3 -4
  45. package/lib/shim/transaction-shim.js +0 -1
  46. package/lib/shim/webframework-shim/common.js +2 -4
  47. package/lib/shim/webframework-shim/middleware.js +8 -8
  48. package/lib/spans/span-context.js +1 -1
  49. package/lib/spans/span-event-aggregator.js +2 -2
  50. package/lib/spans/span-event.js +6 -5
  51. package/lib/spans/streaming-span-attributes.js +1 -1
  52. package/lib/spans/streaming-span-event-aggregator.js +1 -2
  53. package/lib/stats/index.js +1 -1
  54. package/lib/subscriber-configs.js +2 -0
  55. package/lib/subscribers/amqplib/accept-message.js +14 -0
  56. package/lib/subscribers/amqplib/callback-model.js +39 -0
  57. package/lib/subscribers/amqplib/channel-model.js +39 -0
  58. package/lib/subscribers/amqplib/config.js +695 -0
  59. package/lib/subscribers/amqplib/connect.js +74 -0
  60. package/lib/subscribers/amqplib/consume.js +54 -0
  61. package/lib/subscribers/amqplib/get-cb.js +16 -0
  62. package/lib/subscribers/amqplib/get.js +50 -0
  63. package/lib/subscribers/amqplib/purge-queue-cb.js +16 -0
  64. package/lib/subscribers/amqplib/purge-queue.js +37 -0
  65. package/lib/subscribers/amqplib/send-message.js +44 -0
  66. package/lib/subscribers/amqplib/send-or-enqueue.js +20 -0
  67. package/lib/subscribers/amqplib/utils.js +53 -0
  68. package/lib/subscribers/application-logs.js +1 -1
  69. package/lib/subscribers/base.js +167 -9
  70. package/lib/subscribers/cassandra-driver/client-batch.js +49 -0
  71. package/lib/subscribers/cassandra-driver/client-connect.js +35 -0
  72. package/lib/subscribers/cassandra-driver/client-each-row.js +36 -0
  73. package/lib/subscribers/cassandra-driver/client-execute.js +36 -0
  74. package/lib/subscribers/cassandra-driver/client-shutdown.js +32 -0
  75. package/lib/subscribers/cassandra-driver/config.js +145 -0
  76. package/lib/subscribers/cassandra-driver/legacy-client-batch.js +22 -0
  77. package/lib/subscribers/cassandra-driver/legacy-client-connect.js +22 -0
  78. package/lib/subscribers/cassandra-driver/legacy-client-each-row.js +22 -0
  79. package/lib/subscribers/cassandra-driver/legacy-client-execute.js +21 -0
  80. package/lib/subscribers/cassandra-driver/legacy-client-shutdown.js +32 -0
  81. package/lib/subscribers/create-config.js +2 -4
  82. package/lib/subscribers/db-query.js +5 -1
  83. package/lib/subscribers/message-consumer.js +146 -0
  84. package/lib/subscribers/message-producer.js +60 -0
  85. package/lib/subscribers/meta-subscriber.js +69 -0
  86. package/lib/subscribers/openai/base.js +27 -1
  87. package/lib/subscribers/openai/config.js +6 -6
  88. package/lib/subscribers/openai/utils.js +9 -11
  89. package/lib/subscribers/propagation.js +43 -0
  90. package/lib/timer.js +1 -1
  91. package/lib/transaction/dt-payload.js +1 -1
  92. package/lib/transaction/handle.js +8 -9
  93. package/lib/transaction/name-state.js +11 -11
  94. package/lib/transaction/trace/segment.js +2 -3
  95. package/lib/util/attribute-types.js +1 -1
  96. package/lib/util/byte-limit.js +1 -1
  97. package/lib/util/cat.js +13 -13
  98. package/lib/util/flatten.js +2 -3
  99. package/lib/util/is-absolute-path.js +1 -1
  100. package/lib/util/is-string.js +15 -0
  101. package/lib/util/logger.js +6 -6
  102. package/lib/util/stream-sink.js +1 -1
  103. package/lib/utilization/docker-info.js +4 -3
  104. package/lib/w3c/traceparent.js +1 -1
  105. package/package.json +2 -2
  106. package/lib/instrumentation/amqplib/amqplib.js +0 -122
  107. package/lib/instrumentation/amqplib/channel-model.js +0 -124
  108. package/lib/instrumentation/amqplib/channel.js +0 -72
  109. package/lib/instrumentation/amqplib/nr-hooks.js +0 -21
  110. package/lib/instrumentation/amqplib/utils.js +0 -143
  111. package/lib/instrumentation/cassandra-driver.js +0 -131
@@ -24,10 +24,10 @@ function wrapKeys(metacall) {
24
24
  *
25
25
  * instrument the memcached driver to intercept calls and keep stats on them.
26
26
  *
27
- * @param agent
28
- * @param memcached
29
- * @param moduleName
30
- * @param shim
27
+ * @param {Agent} agent instance
28
+ * @param {Object} memcached library
29
+ * @param {string} moduleName name of module
30
+ * @param {Shim} shim instance
31
31
  */
32
32
  module.exports = function initialize(agent, memcached, moduleName, shim) {
33
33
  const proto = memcached && memcached.prototype
@@ -22,10 +22,10 @@ module.exports = initialize
22
22
  * Registers the query parser, and relevant instrumentation
23
23
  * based on version of mongodb
24
24
  *
25
- * @param {Agent} agent
25
+ * @param {Agent} agent instance
26
26
  * @param {object} mongodb resolved package
27
27
  * @param {string} moduleName name of module
28
- * @param {Shim} shim
28
+ * @param {Shim} shim instance
29
29
  */
30
30
  function initialize(agent, mongodb, moduleName, shim) {
31
31
  if (!mongodb) {
@@ -25,7 +25,7 @@ const channels = [
25
25
  * Subscribes to all relevant undici hook points
26
26
  * See: https://github.com/nodejs/undici/blob/main/docs/api/DiagnosticsChannel.md
27
27
  *
28
- * @param agent
28
+ * @param {Agent} agent instance
29
29
  */
30
30
  module.exports = function addUndiciChannels(agent) {
31
31
  channels.forEach(({ channel, hook }, index) => {
@@ -72,8 +72,8 @@ function addDTHeaders({ transaction, config, request }) {
72
72
  *
73
73
  * @param {object} params object to fn
74
74
  * @param {Agent} params.agent NR agent instance
75
+ * @param {object} params.request undici request object
75
76
  * @param {object} params.context active context
76
- * @param params.request
77
77
  */
78
78
  function createExternalSegment({ agent, request, context }) {
79
79
  const url = new URL(request.origin + request.path)
@@ -155,7 +155,7 @@ function requestCreateHook(agent, { request }) {
155
155
  * We will add the relevant http response attributes to active segment.
156
156
  * Also add CAT specific keys to active segment.
157
157
  *
158
- * @param {object} agent
158
+ * @param {Agent} agent instance
159
159
  * @param {object} params object from undici hook
160
160
  * @param {object} params.response { statusCode, headers, statusText }
161
161
  */
@@ -19,11 +19,9 @@ module.exports = function instrumentations() {
19
19
  '@node-redis/client': { type: InstrumentationDescriptor.TYPE_DATASTORE },
20
20
  '@prisma/client': { type: InstrumentationDescriptor.TYPE_DATASTORE },
21
21
  '@redis/client': { type: InstrumentationDescriptor.TYPE_DATASTORE },
22
- amqplib: { module: './instrumentation/amqplib' },
23
22
  'aws-sdk': { module: './instrumentation/aws-sdk' },
24
23
  bluebird: { type: InstrumentationDescriptor.TYPE_PROMISE },
25
24
  bunyan: { type: InstrumentationDescriptor.TYPE_GENERIC },
26
- 'cassandra-driver': { type: InstrumentationDescriptor.TYPE_DATASTORE },
27
25
  connect: { type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK },
28
26
  express: { type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK },
29
27
  fastify: { type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK },
@@ -34,10 +34,10 @@ class BedrockResponse {
34
34
  #isConverse
35
35
 
36
36
  /**
37
- * @param {object} params
38
- * @param {AwsBedrockMiddlewareResponse} params.response
39
- * @param {BedrockCommand} params.bedrockCommand
40
- * @param {boolean} params.isError
37
+ * @param {object} params params object
38
+ * @param {AwsBedrockMiddlewareResponse} params.response AWS Bedrock middleware response
39
+ * @param {BedrockCommand} params.bedrockCommand AWS Bedrock command
40
+ * @param {boolean} params.isError is there an error
41
41
  */
42
42
  constructor({ response, bedrockCommand, isError = false }) {
43
43
  this.#originalResponse = response
@@ -146,8 +146,8 @@ class BedrockResponse {
146
146
 
147
147
  /**
148
148
  * Extracts and sets #completions and #id from the InvokeModel response body.
149
- * @param {BedrockCommand} cmd
150
- * @param {*} body
149
+ * @param {BedrockCommand} cmd AWS Bedrock Command
150
+ * @param {*} body InvokeModel response body
151
151
  */
152
152
  #extractCompletionsAndId(cmd, body) {
153
153
  if (cmd.isClaude() === true) {
@@ -101,7 +101,7 @@ class ConverseStreamHandler {
101
101
  * If the given event is the last event in the stream, update the response
102
102
  * headers with the metrics data from the event.
103
103
  *
104
- * @param {object} parsedEvent
104
+ * @param {object} parsedEvent parsed stream event
105
105
  */
106
106
  updateHeaders(parsedEvent) {
107
107
  this.response.response.headers = {
@@ -145,8 +145,8 @@ class StreamHandler {
145
145
  * Finds the reason for the end of the stream based upon the model's known
146
146
  * stop reason key.
147
147
  *
148
- * @param {object} event
149
- * @returns {string}
148
+ * @param {object} event stream event
149
+ * @returns {string} the stop reason
150
150
  */
151
151
  getStopReason(event) {
152
152
  if (this.stopReasonKey.includes('.')) {
@@ -164,7 +164,7 @@ class StreamHandler {
164
164
  /**
165
165
  * Decodes the Uint8Array that represents a model response.
166
166
  *
167
- * @param {object} event
167
+ * @param {object} event stream event
168
168
  *
169
169
  * @returns {object}
170
170
  */
@@ -177,7 +177,7 @@ class StreamHandler {
177
177
  * If the given event is the last event in the stream, update the response
178
178
  * headers with the metrics data from the event.
179
179
  *
180
- * @param {object} parsedEvent
180
+ * @param {object} parsedEvent the parsed stream event
181
181
  */
182
182
  updateHeaders(parsedEvent) {
183
183
  if (this.getStopReason(parsedEvent) === null) {
@@ -44,7 +44,7 @@ const FROM_MILLIS = 1e-3
44
44
  * @param {number} apdexT The apdex-tolerating value, for use in creating apdex
45
45
  * statistics.
46
46
  * @param {MetricMapper} mapper The mapper that turns metric names into IDs.
47
- * @param normalizer
47
+ * @param {NameNormalizer} normalizer The normalizer that standardizes metric names.
48
48
  */
49
49
  function Metrics(apdexT, mapper, normalizer) {
50
50
  if (apdexT == null || apdexT === '') {
@@ -268,7 +268,7 @@ Metrics.prototype._getUnscopedData = function _getUnscopedData(name) {
268
268
  * mappings along the way. Split from _getUnscopedData for performance.
269
269
  *
270
270
  * @param {string} name The string to look up.
271
- * @param scope
271
+ * @param {string} scope The scope to map with.
272
272
  */
273
273
  Metrics.prototype._getScopedData = function _getScopedData(name, scope) {
274
274
  if (!this.scoped[scope][name]) {
@@ -10,7 +10,7 @@ const logger = require('../../logger').child({ component: 'normalizer_rule' })
10
10
  /**
11
11
  * JavaScript just has to do things slightly differently.
12
12
  *
13
- * @param input
13
+ * @param {string} input the input string
14
14
  */
15
15
  const replaceReplacer = function replaceReplacer(input) {
16
16
  return input.replace(/\\/g, '$')
@@ -48,7 +48,7 @@ function plain(normalized, path) {
48
48
  * @param {object} config The agent's configuration blob, which has a parameter
49
49
  * that indicates whether to enforce the normalization
50
50
  * backstop.
51
- * @param type
51
+ * @param {string} type The type of normalization to apply.
52
52
  */
53
53
  function MetricNormalizer(config, type) {
54
54
  if (!config) {
@@ -88,9 +88,8 @@ util.inherits(MetricNormalizer, EventEmitter)
88
88
  * Convert the raw, de-serialized JSON response into a set of
89
89
  * NormalizationRules.
90
90
  *
91
- * @param object json The de-serialized JSON response sent on collector
91
+ * @param {object} json The de-serialized JSON response sent on collector
92
92
  * connection.
93
- * @param json
94
93
  */
95
94
  MetricNormalizer.prototype.load = function load(json) {
96
95
  if (json) {
@@ -118,8 +117,8 @@ MetricNormalizer.prototype.load = function load(json) {
118
117
  /**
119
118
  * Helper for loadFromConfig
120
119
  *
121
- * @param rule {object} from this.config.rules
122
- * @param ctx {object} context from the calling function
120
+ * @param {object} rule from this.config.rules
121
+ * @param {object} ctx context from the calling function
123
122
  */
124
123
  function processNameRule(rule, ctx) {
125
124
  if (!rule.pattern) {
@@ -8,9 +8,9 @@
8
8
  const NAMES = require('../../metrics/names.js')
9
9
 
10
10
  /**
11
- * @param {TraceSegment} segment
12
- * @param {object} scope
13
- * @param {Transaction} tx
11
+ * @param {TraceSegment} segment segment
12
+ * @param {object} [scope] scope
13
+ * @param {Transaction} tx transaction
14
14
  */
15
15
  function recordMessageTransaction(segment, scope, tx) {
16
16
  if (tx.type !== 'message' || tx.baseSegment !== segment) {
@@ -31,10 +31,10 @@ class ContextManager {
31
31
  * Runs the callback within the provided context, optionally
32
32
  * bound with a provided `this`.
33
33
  *
34
- * @param context
35
- * @param callback
36
- * @param thisRef
37
- * @param args
34
+ * @param {Object} context context
35
+ * @param {function} callback callback
36
+ * @param {Object} thisRef `this` reference
37
+ * @param {...any} args arguments
38
38
  */
39
39
  with(context, callback, thisRef, ...args) {
40
40
  return this.#ctxMgr.runInContext(context, callback, thisRef, args)
@@ -42,7 +42,7 @@ class SetupMetrics extends SetupSignal {
42
42
  const getMeter = provider.getMeter
43
43
  provider.getMeter = function nrGetMeter(...args) {
44
44
  agent.metrics
45
- .getOrCreateMetric('Supportability/Nodejs/OpenTelemetryBridge/Metrics/getMeter')
45
+ .getOrCreateMetric('Supportability/Metrics/Nodejs/OpenTelemetryBridge/getMeter')
46
46
  .incrementCallCount()
47
47
 
48
48
  const meter = getMeter.apply(provider, args)
@@ -61,7 +61,7 @@ class SetupMetrics extends SetupSignal {
61
61
  // + createObservableUpDownCounter
62
62
  meter[method] = function nrWrappedMethod(...args) {
63
63
  agent.metrics
64
- .getOrCreateMetric(`Supportability/Nodejs/OpenTelemetryBridge/Metrics/meter/${method}`)
64
+ .getOrCreateMetric(`Supportability/Metrics/Nodejs/OpenTelemetryBridge/meter/${method}`)
65
65
  .incrementCallCount()
66
66
  return originals[method].apply(meter, args)
67
67
  }
@@ -73,7 +73,7 @@ class SetupMetrics extends SetupSignal {
73
73
  this.coreApi.metrics.setGlobalMeterProvider(provider)
74
74
 
75
75
  agent.metrics
76
- .getOrCreateMetric('Supportability/Nodejs/OpenTelemetryBridge/Metrics')
76
+ .getOrCreateMetric('Supportability/Metrics/Nodejs/OpenTelemetryBridge/enabled')
77
77
  .incrementCallCount()
78
78
 
79
79
  // We need access to `agent.config.entity_guid` in order to attach metrics
package/lib/otel/setup.js CHANGED
@@ -41,6 +41,9 @@ function setupOtel(agent, logger = defaultLogger) {
41
41
  signals.push(signal)
42
42
  } else {
43
43
  logger.debug('`opentelemetry_bridge.traces` is not enabled, skipping')
44
+ agent.metrics
45
+ .getOrCreateMetric('Supportability/Tracing/Nodejs/OpenTelemetryBridge/disabled')
46
+ .incrementCallCount()
44
47
  }
45
48
 
46
49
  if (agent.config.opentelemetry_bridge.metrics.enabled === true) {
@@ -48,6 +51,9 @@ function setupOtel(agent, logger = defaultLogger) {
48
51
  signals.push(signal)
49
52
  } else {
50
53
  logger.debug('`opentelemetry_bridge.metrics` is not enabled, skipping')
54
+ agent.metrics
55
+ .getOrCreateMetric('Supportability/Metrics/Nodejs/OpenTelemetryBridge/disabled')
56
+ .incrementCallCount()
51
57
  }
52
58
 
53
59
  if (agent.config.opentelemetry_bridge.logs.enabled === true) {
@@ -25,7 +25,7 @@ class TraceState {
25
25
 
26
26
  /**
27
27
  * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}
28
- * @param traceParent - A meta property that comes from server.
28
+ * @param {string} traceParent - A meta property that comes from server.
29
29
  * It should be dynamically generated server side to have the server's request trace Id,
30
30
  * a parent span Id that was set on the server's request span,
31
31
  * and the trace flags to indicate the server's sampling decision
@@ -28,7 +28,7 @@ class SetupTraces extends SetupSignal {
28
28
  this.coreApi.trace.setGlobalTracerProvider(traceProvider)
29
29
 
30
30
  agent.metrics
31
- .getOrCreateMetric('Supportability/Nodejs/OpenTelemetryBridge/Traces')
31
+ .getOrCreateMetric('Supportability/Tracing/Nodejs/OpenTelemetryBridge/enabled')
32
32
  .incrementCallCount()
33
33
  }
34
34
 
@@ -139,8 +139,8 @@ class PrioritizedAttributes {
139
139
  * Returns true if a given key is valid for any of the
140
140
  * provided destinations.
141
141
  *
142
- * @param {DESTINATIONS} destinations
143
- * @param {string} key
142
+ * @param {DESTINATIONS} destinations destinations to check against
143
+ * @param {string} key key to check
144
144
  */
145
145
  hasValidDestination(destinations, key) {
146
146
  const validDestinations = this.filter(destinations, key)
@@ -105,8 +105,8 @@ class AwsLambda {
105
105
  /**
106
106
  * Response-streaming handlers are identified by symbol properties on the function.
107
107
  * We propagate any symbols if they're present, so that the handler keeps its signatue for any AWS features that rely on symbols
108
- * @param handler
109
- * @param nrHandler
108
+ * @param {Object} handler original handler
109
+ * @param {Object} nrHandler our copy of the handler
110
110
  */
111
111
  propagateSymbols(handler, nrHandler) {
112
112
  for (const symbol of Object.getOwnPropertySymbols(handler)) {
@@ -191,7 +191,7 @@ class AwsLambda {
191
191
  * **Note**: AWS doesn't support response streaming with API gateway invoked lambdas.
192
192
  * This means we do not handle that as it would require intercepting the stream to parse
193
193
  * the response code and headers.
194
- * @param {...any} args
194
+ * @param {...any} args Original arguments
195
195
  */
196
196
  function wrappedStreamHandler(...args) {
197
197
  const transaction = shim.tracer.getTransaction()
@@ -229,7 +229,7 @@ class AwsLambda {
229
229
  * adds handlers if api gateway to wrap request/response
230
230
  * wraps the callback(if present), wraps the context `done`, `succeed`, `fail methods`, intercepts promise
231
231
  * and properly ends transaction
232
- * @param {...any} args
232
+ * @param {...any} args Original arguments
233
233
  */
234
234
  function wrappedHandler(...args) {
235
235
  const transaction = shim.tracer.getTransaction()
@@ -500,7 +500,7 @@ function captureInstanceAttributes(host, port, database) {
500
500
  /**
501
501
  * Parses the database name from a `USE` SQL query.
502
502
  *
503
- * @memberof DatastoreShim.prototype
503
+ * @this DatastoreShim
504
504
  * @param {string} query - The SQL query to parse the database name from.
505
505
  * @returns {?string} The name of the database if it could be parsed, otherwise
506
506
  * `null`.
@@ -49,7 +49,7 @@ function updateSpecFromArgs({ shim, fn, fnName, args, spec, ctx }) {
49
49
  * @param {MessageShim} params.shim instance of shim
50
50
  * @param {Function} params.fn function that is being wrapped
51
51
  * @param {string} params.fnName name of function
52
- * @param params.args
52
+ * @param {Array} params.args arguments passed to original consume function
53
53
  * @param {specs.MessageSpec} params.spec spec for the wrapped consume function
54
54
  * @returns {specs.MessageSpec} updated spec with logic to name segment and apply the genericRecorder
55
55
  */
@@ -37,8 +37,7 @@ function _nameMessageTransaction(shim, msgDesc) {
37
37
  * @param {MessageShim} params.shim instance of shim
38
38
  * @param {Function} params.fn subscriber function
39
39
  * @param {specs.MessageSubscribeSpec} params.spec spec for subscriber
40
- * @param params.name
41
- * @param {boolean} params.destNameIsArg flag to state if destination is an argument
40
+ * @param {string} params.name function name
42
41
  * @returns {Function} wrapped subscribe function
43
42
  */
44
43
  function createSubscriberWrapper({ shim, fn, spec, name }) {
@@ -366,9 +366,7 @@ function _wrapExecutorContext(shim, args) {
366
366
 
367
367
  /**
368
368
  *
369
- * @param {Function} resolve function of promise
370
- * @param {Function} reject function of promise
371
- * @param {...any} args
369
+ * @param {Object} args contains the `resolve` and `reject` functions of a promise
372
370
  */
373
371
  function contextExporter(...args) {
374
372
  const [resolve, reject] = args
package/lib/shim/shim.js CHANGED
@@ -1453,8 +1453,7 @@ function isPromise(obj) {
1453
1453
  * promise or async function
1454
1454
  *
1455
1455
  * @memberof Shim.prototype
1456
- * @param fn
1457
- * @param (function) function to test if async
1456
+ * @param {function} fn function to test if async
1458
1457
  * @returns {boolean} True if the function is an async function
1459
1458
  */
1460
1459
  function isAsyncFunction(fn) {
@@ -1871,8 +1870,8 @@ function _makeBindWrapper(shim, func, context, full) {
1871
1870
  * (i.e. `bindRowCallbackSegment` for `rowCallback`), but will fall back to the
1872
1871
  * generic callback binding method, `bindCallbackSegment`, otherwise.
1873
1872
  *
1874
- * @this *
1875
1873
  * @private
1874
+ * @this *
1876
1875
  * @param {Shim} shim
1877
1876
  * The shim performing this binding.
1878
1877
  * @param {Function} fn
@@ -2129,7 +2128,7 @@ function _es5WrapClass(shim, Base, fnName, spec, args) {
2129
2128
  /**
2130
2129
  * Wraps the es5 class in a function
2131
2130
  *
2132
- * @param {...any} cnstrctArgs
2131
+ * @param {...any} cnstrctArgs class constructor arguments
2133
2132
  * @returns {Function|undefined} a function if not already wrapped in WrappedClass
2134
2133
  */
2135
2134
  function WrappedClass(...cnstrctArgs) {
@@ -19,7 +19,6 @@ const TRANSACTION_TYPES_SET = Transaction.TYPES_SET
19
19
  * @class
20
20
  * @augments Shim
21
21
  * @classdesc
22
- * @param shimName
23
22
  * A helper class for working with transactions.
24
23
  * @param {Agent} agent - The agent the shim will use.
25
24
  * @param {string} moduleName - The name of the module being instrumented.
@@ -46,8 +46,6 @@ common.getTransactionInfo = function getTransactionInfo(shim, req) {
46
46
  * Adds the given error to the transaction information if it is actually an error.
47
47
  *
48
48
  * @private
49
- * @param {WebFrameworkShim} shim
50
- * The shim used for this web framework.
51
49
  * @param {TransactionInfo} txInfo
52
50
  * The transaction context information for the request.
53
51
  * @param {*} err
@@ -73,8 +71,8 @@ common.isError = function isError(shim, err) {
73
71
  }
74
72
 
75
73
  /**
76
- * @param shim
77
- * @param req
74
+ * @param {Object} shim instance
75
+ * @param {Object} req request
78
76
  */
79
77
  common.makeGetReq = function makeGetReq(shim, req) {
80
78
  return function getReqFromArgs(shim, fn, name, args) {
@@ -331,14 +331,14 @@ module.exports._recordMiddleware = function _recordMiddleware(shim, middleware,
331
331
  * push the name state if there is a next so that we can safely remove it
332
332
  * if context leaves this middleware.
333
333
  *
334
- * @param root0
335
- * @param root0.shim
336
- * @param root0.spec
337
- * @param root0.route
338
- * @param root0.args
339
- * @param root0.isErrorWare
340
- * @param root0.isPromise
341
- * @param root0.txInfo
334
+ * @param {Object} params params object
335
+ * @param {Shim} params.shim shim instance
336
+ * @param {Object} params.spec middleware spec, should contain a next function
337
+ * @param {string} params.route route
338
+ * @param {Array} params.args arguments
339
+ * @param {boolean} params.isErrorWare is this error ware
340
+ * @param {boolean} params.isPromise is this a promise
341
+ * @param {Object} params.txInfo transaction information
342
342
  * @private
343
343
  */
344
344
  function wrapNextHandler({ shim, spec, route, args, isErrorWare, isPromise, txInfo }) {
@@ -41,7 +41,7 @@ class SpanContext {
41
41
  *
42
42
  * Last error wins.
43
43
  *
44
- * @param details
44
+ * @param {Obejct} details error details
45
45
  */
46
46
  setError(details) {
47
47
  this.hasError = true
@@ -87,7 +87,7 @@ class SpanEventAggregator extends EventAggregator {
87
87
  /**
88
88
  * Reconfigure the `SpanEventAggregator` based on values from server
89
89
  *
90
- * @param {Config} config
90
+ * @param {Config} config the config to reconfigure with
91
91
  */
92
92
  reconfigure(config) {
93
93
  super.reconfigure(config)
@@ -105,7 +105,7 @@ class SpanEventAggregator extends EventAggregator {
105
105
  * When no `span_event_harvest_config` has been received from the server, applies an
106
106
  * agent-defined fallback maximum to protect against collecting and sending too many spans.
107
107
  *
108
- * @param {Config} config
108
+ * @param {Config} config the config to check
109
109
  */
110
110
  _getValidSpanConfiguration(config) {
111
111
  const spanHarvestConfig = config.span_event_harvest_config
@@ -89,11 +89,12 @@ class SpanEvent {
89
89
  * The constructed span event will contain extra data depending on the
90
90
  * category of the segment.
91
91
  *
92
- * @param {TraceSegment} segment segment to turn into a span event.
93
- * @param {Transaction} transaction active transaction
94
- * @param {?string} [parentId] ID of the segment's parent.
95
- * @param {boolean} isRoot if segment is root segment
96
- * @param {boolean} inProcessSpans if the segment is in-process, create span
92
+ * @param {Object} params params object
93
+ * @param {TraceSegment} params.segment segment to turn into a span event.
94
+ * @param {Transaction} params.transaction active transaction
95
+ * @param {?string} [params.parentId] ID of the segment's parent.
96
+ * @param {boolean} [params.isRoot] if segment is root segment; defaults to `false`
97
+ * @param {boolean} params.inProcessSpans if the segment is in-process, create span
97
98
  * @returns {SpanEvent} The constructed event.
98
99
  */
99
100
  static fromSegment({ segment, transaction, parentId = null, isRoot = false, inProcessSpans }) {
@@ -46,7 +46,7 @@ class StreamingSpanAttributes {
46
46
  *
47
47
  * Does not apply filtering/truncation.
48
48
  *
49
- * @param {object} [attributes]
49
+ * @param {object} [attributes] Attributes to add.
50
50
  * @param {string} [attributes.key] Name of the attribute to be stored.
51
51
  * @param {string|boolean|number} [attributes.value] Value of the attribute to be stored.
52
52
  */
@@ -101,10 +101,9 @@ class StreamingSpanEventAggregator extends Aggregator {
101
101
  *
102
102
  * @param {object} params to function
103
103
  * @param {TraceSegment} params.segment segment to add.
104
- * @param {string} [parms.parentId] GUID of the parent span.
105
104
  * @param {Transaction} params.transaction active transaction
105
+ * @param {string} [params.parentId] GUID of the parent span.
106
106
  * @param {boolean} params.isRoot is segment root segment
107
- * @param params.parentId
108
107
  * @returns {boolean} True if the segment was added, or false if it was discarded.
109
108
  */
110
109
  addSegment({ segment, transaction, parentId, isRoot }) {
@@ -84,7 +84,7 @@ Stats.prototype.incrementCallCount = function incrementCallCount(count) {
84
84
  /**
85
85
  * Fold another summary's statistics into this one.
86
86
  *
87
- * @param other
87
+ * @param {Stats} other other Stats instance
88
88
  */
89
89
  Stats.prototype.merge = function merge(other) {
90
90
  if (other.count && !other.callCount) {
@@ -8,6 +8,8 @@
8
8
  // The expected export of these files is:
9
9
  // 'package-name': [ { path: 'subscriberPath', instrumentations: [] }, ... ]
10
10
  const subscribers = {
11
+ ...require('./subscribers/amqplib/config'),
12
+ ...require('./subscribers/cassandra-driver/config'),
11
13
  ...require('./subscribers/elasticsearch/config'),
12
14
  ...require('./subscribers/ioredis/config'),
13
15
  ...require('./subscribers/mcp-sdk/config'),
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright 2025 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ const PropagationSubscriber = require('../propagation')
7
+
8
+ class AcceptMessageSubscriber extends PropagationSubscriber {
9
+ constructor({ agent, logger }) {
10
+ super({ agent, logger, packageName: 'amqplib', channelName: 'nr_acceptMessage', callback: 0 })
11
+ }
12
+ }
13
+
14
+ module.exports = AcceptMessageSubscriber
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2025 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ const MetaSubscriber = require('../meta-subscriber')
7
+ const CHANNEL_METHODS = [
8
+ 'cb_close',
9
+ 'cb_open',
10
+ 'cb_assertQueue',
11
+ 'cb_checkQueue',
12
+ 'cb_deleteQueue',
13
+ 'cb_bindQueue',
14
+ 'nr_unbindQueue',
15
+ 'cb_assertExchange',
16
+ 'cb_checkExchange',
17
+ 'cb_deleteExchange',
18
+ 'cb_bindExchange',
19
+ 'cb_unbindExchange',
20
+ 'cb_cancel',
21
+ 'cb_prefetch',
22
+ 'cb_recover'
23
+ ]
24
+
25
+ class ChannelModelSubscriber extends MetaSubscriber {
26
+ constructor({ agent, logger }) {
27
+ super({ agent, logger, packageName: 'amqplib', channelName: 'channelModel', channels: CHANNEL_METHODS, events: ['asyncEnd'], callback: -1 })
28
+ }
29
+
30
+ handler(_data, ctx) {
31
+ const [, name] = this.channelName.split('_')
32
+ return this.createSegment({
33
+ name: `Channel#${name}`,
34
+ ctx
35
+ })
36
+ }
37
+ }
38
+
39
+ module.exports = ChannelModelSubscriber
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2025 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ const MetaSubscriber = require('../meta-subscriber')
7
+ const CHANNEL_METHODS = [
8
+ 'nr_close',
9
+ 'nr_open',
10
+ 'nr_assertQueue',
11
+ 'nr_checkQueue',
12
+ 'nr_deleteQueue',
13
+ 'nr_bindQueue',
14
+ 'nr_unbindQueue',
15
+ 'nr_assertExchange',
16
+ 'nr_checkExchange',
17
+ 'nr_deleteExchange',
18
+ 'nr_bindExchange',
19
+ 'nr_unbindExchange',
20
+ 'nr_cancel',
21
+ 'nr_prefetch',
22
+ 'nr_recover'
23
+ ]
24
+
25
+ class ChannelModelSubscriber extends MetaSubscriber {
26
+ constructor({ agent, logger }) {
27
+ super({ agent, logger, packageName: 'amqplib', channelName: 'channelModel', channels: CHANNEL_METHODS, events: ['asyncEnd'] })
28
+ }
29
+
30
+ handler(data, ctx) {
31
+ const [, name] = this.channelName.split('_')
32
+ return this.createSegment({
33
+ name: `Channel#${name}`,
34
+ ctx
35
+ })
36
+ }
37
+ }
38
+
39
+ module.exports = ChannelModelSubscriber