@newrelic/browser-agent 1.323.0-rc.5 → 1.323.0-rc.6
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.
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +17 -4
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +18 -5
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/ajax/aggregate/index.js +15 -2
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.323.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.323.0-rc.6";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.323.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.323.0-rc.6";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -133,10 +133,23 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
133
133
|
...event,
|
|
134
134
|
targetAttributes: (0, _utils.getVersion2Attributes)(target, this)
|
|
135
135
|
});
|
|
136
|
-
if ((0, _utils.shouldDuplicate)(target, this))
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
if ((0, _utils.shouldDuplicate)(target, this)) {
|
|
137
|
+
const duplicateEvent = {
|
|
138
|
+
...event,
|
|
139
|
+
targetAttributes: (0, _utils.getVersion2DuplicationAttributes)(target, this)
|
|
140
|
+
};
|
|
141
|
+
/** the container-duplicate copy represents the same single real HTTP call as the MFE event above, so it
|
|
142
|
+
* needs its own independent trace/span identity -- otherwise the two would collide on the same
|
|
143
|
+
* spanId/traceId, and BELC could not create two separate Spans/Traces from them. Only the id namespace is
|
|
144
|
+
* independent; spanTimestamp is intentionally left as-is (event.spanTimestamp), since it still reflects the
|
|
145
|
+
* real call's actual timing. When `event.spanId` was never set (e.g. distributed tracing is disabled), there
|
|
146
|
+
* is no span identity to duplicate either -- both copies correctly end up with no spanId/traceId. */
|
|
147
|
+
if (event.spanId) {
|
|
148
|
+
duplicateEvent.spanId = (0, _uniqueId.generateSpanId)();
|
|
149
|
+
duplicateEvent.traceId = (0, _uniqueId.generateTraceId)();
|
|
150
|
+
}
|
|
151
|
+
this.reportContainerEvent(duplicateEvent, ctx);
|
|
152
|
+
}
|
|
140
153
|
} else {
|
|
141
154
|
this.reportContainerEvent(event, ctx);
|
|
142
155
|
}
|
|
@@ -16,7 +16,7 @@ import { canCapturePayload, isLikelyHumanReadable, parseQueryString, createStrin
|
|
|
16
16
|
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
17
17
|
import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate, isMfeTarget } from '../../../common/v2/utils';
|
|
18
18
|
import { EVENT_TYPES } from '../../../common/constants/events';
|
|
19
|
-
import { generateUuid } from '../../../common/ids/unique-id';
|
|
19
|
+
import { generateSpanId, generateTraceId, generateUuid } from '../../../common/ids/unique-id';
|
|
20
20
|
export class Aggregate extends AggregateBase {
|
|
21
21
|
static featureName = FEATURE_NAME;
|
|
22
22
|
constructor(agentRef) {
|
|
@@ -126,10 +126,23 @@ export class Aggregate extends AggregateBase {
|
|
|
126
126
|
...event,
|
|
127
127
|
targetAttributes: getVersion2Attributes(target, this)
|
|
128
128
|
});
|
|
129
|
-
if (shouldDuplicate(target, this))
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (shouldDuplicate(target, this)) {
|
|
130
|
+
const duplicateEvent = {
|
|
131
|
+
...event,
|
|
132
|
+
targetAttributes: getVersion2DuplicationAttributes(target, this)
|
|
133
|
+
};
|
|
134
|
+
/** the container-duplicate copy represents the same single real HTTP call as the MFE event above, so it
|
|
135
|
+
* needs its own independent trace/span identity -- otherwise the two would collide on the same
|
|
136
|
+
* spanId/traceId, and BELC could not create two separate Spans/Traces from them. Only the id namespace is
|
|
137
|
+
* independent; spanTimestamp is intentionally left as-is (event.spanTimestamp), since it still reflects the
|
|
138
|
+
* real call's actual timing. When `event.spanId` was never set (e.g. distributed tracing is disabled), there
|
|
139
|
+
* is no span identity to duplicate either -- both copies correctly end up with no spanId/traceId. */
|
|
140
|
+
if (event.spanId) {
|
|
141
|
+
duplicateEvent.spanId = generateSpanId();
|
|
142
|
+
duplicateEvent.traceId = generateTraceId();
|
|
143
|
+
}
|
|
144
|
+
this.reportContainerEvent(duplicateEvent, ctx);
|
|
145
|
+
}
|
|
133
146
|
} else {
|
|
134
147
|
this.reportContainerEvent(event, ctx);
|
|
135
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IAEjC,2BA6BC;IAvBC,uBAA4D;IAyB9D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IAEjC,2BA6BC;IAvBC,uBAA4D;IAyB9D,0GAwGC;IAED,+CAOC;IAED,iDA2EC;CACF;8BA3O6B,4BAA4B;2BAK/B,gCAAgC"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ import { canCapturePayload, isLikelyHumanReadable, parseQueryString, createStrin
|
|
|
16
16
|
import { Obfuscator } from '../../../common/util/obfuscate'
|
|
17
17
|
import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate, isMfeTarget } from '../../../common/v2/utils'
|
|
18
18
|
import { EVENT_TYPES } from '../../../common/constants/events'
|
|
19
|
-
import { generateUuid } from '../../../common/ids/unique-id'
|
|
19
|
+
import { generateSpanId, generateTraceId, generateUuid } from '../../../common/ids/unique-id'
|
|
20
20
|
|
|
21
21
|
export class Aggregate extends AggregateBase {
|
|
22
22
|
static featureName = FEATURE_NAME
|
|
@@ -139,7 +139,20 @@ export class Aggregate extends AggregateBase {
|
|
|
139
139
|
/** make a copy of the event for the MFE target if it exists */
|
|
140
140
|
if (isMfeTarget(target)) {
|
|
141
141
|
this.events.add({ ...event, targetAttributes: getVersion2Attributes(target, this) })
|
|
142
|
-
if (shouldDuplicate(target, this))
|
|
142
|
+
if (shouldDuplicate(target, this)) {
|
|
143
|
+
const duplicateEvent = { ...event, targetAttributes: getVersion2DuplicationAttributes(target, this) }
|
|
144
|
+
/** the container-duplicate copy represents the same single real HTTP call as the MFE event above, so it
|
|
145
|
+
* needs its own independent trace/span identity -- otherwise the two would collide on the same
|
|
146
|
+
* spanId/traceId, and BELC could not create two separate Spans/Traces from them. Only the id namespace is
|
|
147
|
+
* independent; spanTimestamp is intentionally left as-is (event.spanTimestamp), since it still reflects the
|
|
148
|
+
* real call's actual timing. When `event.spanId` was never set (e.g. distributed tracing is disabled), there
|
|
149
|
+
* is no span identity to duplicate either -- both copies correctly end up with no spanId/traceId. */
|
|
150
|
+
if (event.spanId) {
|
|
151
|
+
duplicateEvent.spanId = generateSpanId()
|
|
152
|
+
duplicateEvent.traceId = generateTraceId()
|
|
153
|
+
}
|
|
154
|
+
this.reportContainerEvent(duplicateEvent, ctx)
|
|
155
|
+
}
|
|
143
156
|
} else {
|
|
144
157
|
this.reportContainerEvent(event, ctx)
|
|
145
158
|
}
|