@newrelic/browser-agent 1.320.0 → 1.320.1

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 (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/common/constants/env.cdn.js +1 -1
  3. package/dist/cjs/common/constants/env.npm.js +1 -1
  4. package/dist/cjs/common/payloads/payloads.js +3 -2
  5. package/dist/cjs/common/serialize/bel-serializer.js +17 -4
  6. package/dist/cjs/common/v2/mfe-vitals.js +34 -11
  7. package/dist/cjs/features/ajax/aggregate/index.js +19 -8
  8. package/dist/cjs/features/page_view_timing/aggregate/index.js +28 -13
  9. package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +16 -4
  10. package/dist/cjs/features/soft_navigations/aggregate/interaction.js +10 -3
  11. package/dist/esm/common/constants/env.cdn.js +1 -1
  12. package/dist/esm/common/constants/env.npm.js +1 -1
  13. package/dist/esm/common/payloads/payloads.js +3 -2
  14. package/dist/esm/common/serialize/bel-serializer.js +17 -4
  15. package/dist/esm/common/v2/mfe-vitals.js +34 -11
  16. package/dist/esm/features/ajax/aggregate/index.js +19 -8
  17. package/dist/esm/features/page_view_timing/aggregate/index.js +28 -13
  18. package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +16 -4
  19. package/dist/esm/features/soft_navigations/aggregate/interaction.js +10 -3
  20. package/dist/types/common/payloads/payloads.d.ts +3 -2
  21. package/dist/types/common/payloads/payloads.d.ts.map +1 -1
  22. package/dist/types/common/serialize/bel-serializer.d.ts +9 -1
  23. package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
  24. package/dist/types/common/v2/mfe-vitals.d.ts.map +1 -1
  25. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  26. package/dist/types/features/page_view_timing/aggregate/index.d.ts +0 -1
  27. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  28. package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
  29. package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/common/payloads/payloads.js +3 -2
  32. package/src/common/serialize/bel-serializer.js +13 -4
  33. package/src/common/v2/mfe-vitals.js +39 -12
  34. package/src/features/ajax/aggregate/index.js +12 -9
  35. package/src/features/page_view_timing/aggregate/index.js +19 -14
  36. package/src/features/soft_navigations/aggregate/ajax-node.js +10 -7
  37. package/src/features/soft_navigations/aggregate/interaction.js +6 -5
@@ -42,7 +42,7 @@ export class AjaxNode extends BelNode {
42
42
  }
43
43
 
44
44
  serialize (parentStartTimestamp, agentRef, ajaxObfuscator) {
45
- const { addString, addStringWithTruncation } = createStringAdders(getAddStringContext, ajaxObfuscator)
45
+ const { addString, addStringRaw, addStringWithTruncation } = createStringAdders(getAddStringContext, ajaxObfuscator)
46
46
 
47
47
  const nodeList = []
48
48
 
@@ -54,22 +54,25 @@ export class AjaxNode extends BelNode {
54
54
  numeric(this.end - this.start), // end is relative to start
55
55
  numeric(this.callbackEnd - this.end), // callbackEnd is relative to end
56
56
  numeric(this.callbackDuration), // not relative
57
- addString(this.method),
57
+ addStringRaw(this.method),
58
58
  numeric(this.status),
59
59
  addString(this.domain),
60
60
  addString(this.path),
61
61
  numeric(this.txSize),
62
62
  numeric(this.rxSize),
63
63
  this.requestedWith,
64
- addString(this.nodeId),
65
- nullable(this.spanId, addString, true) + nullable(this.traceId, addString, true) + nullable(this.spanTimestamp, numeric)
64
+ addStringRaw(this.nodeId),
65
+ nullable(this.spanId, addStringRaw, true) + nullable(this.traceId, addStringRaw, true) + nullable(this.spanTimestamp, numeric)
66
66
  ]
67
67
  // Regular attributes: obfuscate only
68
68
  const regularAttrs = addCustomAttributes({
69
- [AJAX_ID]: this[AJAX_ID],
70
69
  ...(this.targetAttributes || {}),
71
70
  ...(this.gql || {})
72
- }, addString)
71
+ }, { addKey: addStringRaw, addVal: addString })
72
+
73
+ regularAttrs.push(...addCustomAttributes({
74
+ [AJAX_ID]: this[AJAX_ID]
75
+ }, { addKey: addStringRaw, addVal: addStringRaw }))
73
76
 
74
77
  // Payload attributes: obfuscate then truncate
75
78
  const payloadAttrs = addCustomAttributes({
@@ -78,7 +81,7 @@ export class AjaxNode extends BelNode {
78
81
  ...(this.requestQuery ? { requestQuery: this.requestQuery } : {}),
79
82
  ...(this.responseBody ? { responseBody: this.responseBody } : {}),
80
83
  ...(this.responseHeaders ? { responseHeaders: this.responseHeaders } : {})
81
- }, addStringWithTruncation)
84
+ }, { addKey: addStringRaw, addVal: addStringWithTruncation })
82
85
 
83
86
  let allAttachedNodes = [...regularAttrs, ...payloadAttrs]
84
87
  this.children.forEach(node => allAttachedNodes.push(node.serialize())) // no children is expected under ajax nodes at this time
@@ -9,6 +9,7 @@ import { now } from '../../../common/timing/now'
9
9
  import { cleanURL } from '../../../common/url/clean-url'
10
10
  import { NODE_TYPE, INTERACTION_STATUS, INTERACTION_TYPE, API_TRIGGER_NAME, IPL_TRIGGER_NAME, NO_LONG_TASK_WINDOW } from '../constants'
11
11
  import { BelNode } from './bel-node'
12
+ import { createStringAdders } from '../../../common/payloads/payloads'
12
13
 
13
14
  /**
14
15
  * link https://github.com/newrelic/nr-querypack/blob/main/schemas/bel/7.qpschema
@@ -139,7 +140,7 @@ export class Interaction extends BelNode {
139
140
  */
140
141
  serialize (firstStartTimeOfPayload, agentRef, interactionObfuscator, ajaxObfuscator) {
141
142
  const isFirstIxnOfPayload = firstStartTimeOfPayload === undefined
142
- const addString = getAddStringContext(interactionObfuscator)
143
+ const { addString, addStringRaw } = createStringAdders(getAddStringContext, interactionObfuscator)
143
144
  const nodeList = []
144
145
  let ixnType
145
146
  if (this.trigger === IPL_TRIGGER_NAME) ixnType = INTERACTION_TYPE.INITIAL_PAGE_LOAD
@@ -154,7 +155,7 @@ export class Interaction extends BelNode {
154
155
  numeric(this.end - this.start), // end -- relative to start
155
156
  numeric(0), // callbackEnd -- relative to start; not used by BrowserInteraction events so these are always 0
156
157
  numeric(0), // not relative; always 0 for BrowserInteraction
157
- addString(this.trigger),
158
+ addStringRaw(this.trigger),
158
159
  addString(cleanURL(this.initialPageURL, true)),
159
160
  addString(cleanURL(this.oldURL, true)),
160
161
  addString(cleanURL(this.newURL, true)),
@@ -162,12 +163,12 @@ export class Interaction extends BelNode {
162
163
  ixnType,
163
164
  nullable(this.queueTime, numeric, true) + nullable(this.appTime, numeric, true) +
164
165
  nullable(this.oldRoute, addString, true) + nullable(this.newRoute, addString, true) +
165
- addString(this.id),
166
- addString(this.nodeId),
166
+ addStringRaw(this.id),
167
+ addStringRaw(this.nodeId),
167
168
  nullable(this.firstPaint, numeric, true) + nullable(this.firstContentfulPaint, numeric)
168
169
  ]
169
170
  const customAttributes = { ...agentRef.info.jsAttributes, ...this.customAttributes } // attrs specific to this interaction should have precedence over the general custom attrs
170
- const allAttachedNodes = addCustomAttributes(customAttributes || {}, addString) // start with all custom attributes
171
+ const allAttachedNodes = addCustomAttributes(customAttributes || {}, { addKey: addStringRaw, addVal: addString }) // start with all custom attributes
171
172
  if (agentRef.info.atts) allAttachedNodes.push('a,' + addString(agentRef.info.atts)) // add apm provided attributes
172
173
  /* Querypack encoder+decoder quirkiness:
173
174
  - If first ixn node of payload is being processed, its children's start time must be offset by this node's start. (firstStartTime should be undefined.)