File tree Expand file tree Collapse file tree 5 files changed +29
-3
lines changed
.github/actions/build-ab/templates Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,12 @@ window.NREUM={
1515 harvest : { interval : 5 } ,
1616 session_replay : {
1717 enabled : true ,
18- autoStart : false ,
1918 fix_stylesheets : false ,
2019 { { #if ( isEnvironment args . environment 'dev' 'staging' ) } }
2120 mask_all_inputs : false ,
2221 mask_text_selector : null ,
22+ { { else } }
23+ autoStart: false ,
2324 { { / i f } }
2425 } ,
2526 session_trace : {
Original file line number Diff line number Diff line change 116116### 57
117117` Failed to execute measure. Arguments must have valid types. `
118118### 58
119- ` Failed to execute measure. Resulting duration must be non-negative. `
119+ ` Failed to execute measure. Resulting duration must be non-negative. `
120+ ### 59
121+ ` Session replay harvested before a session trace payload could be sent. This could be problematic for replays that rely on a trace `
122+ ### 60
123+ ` Session trace aborted `
Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6+ import { dispatchGlobalEvent } from '../dispatch/global-event'
7+
68/* eslint no-console: ["error", { allow: ["debug"] }] */
79
810/**
1416export function warn ( code , secondary ) {
1517 if ( typeof console . debug !== 'function' ) return
1618 console . debug ( `New Relic Warning: https://github.com/newrelic/newrelic-browser-agent/blob/main/docs/warning-codes.md#${ code } ` , secondary )
19+ dispatchGlobalEvent ( {
20+ agentIdentifier : null ,
21+ drained : null ,
22+ type : 'data' ,
23+ name : 'warn' ,
24+ feature : 'warn' ,
25+ data : {
26+ code,
27+ secondary
28+ }
29+ } )
1730}
Original file line number Diff line number Diff line change @@ -262,6 +262,10 @@ export class Aggregate extends AggregateBase {
262262 if ( recorderEvents . type === 'preloaded' ) this . agentRef . runtime . harvester . triggerHarvestFor ( this )
263263 payloadOutput . payload = payload
264264
265+ if ( ! this . agentRef . runtime . session . state . traceHarvestStarted ) {
266+ warn ( 59 , JSON . stringify ( this . agentRef . runtime . session . state ) )
267+ }
268+
265269 return [ payloadOutput ]
266270 }
267271
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { globalScope } from '../../../common/constants/runtime'
1111import { MODE , SESSION_EVENTS } from '../../../common/session/constants'
1212import { applyFnToProps } from '../../../common/util/traverse'
1313import { cleanURL } from '../../../common/url/clean-url'
14+ import { warn } from '../../../common/util/console'
1415
1516const ERROR_MODE_SECONDS_WINDOW = 30 * 1000 // sliding window of nodes to track when simply monitoring (but not harvesting) in error mode
1617/** Reserved room for query param attrs */
@@ -97,6 +98,8 @@ export class Aggregate extends AggregateBase {
9798 }
9899 this . agentRef . runtime . session . write ( { sessionTraceMode : this . mode } )
99100 this . drain ( )
101+ /** try to harvest immediately. This will not send if the trace is not running in FULL mode due to the pre-harvest checks. */
102+ this . agentRef . runtime . harvester . triggerHarvestFor ( this )
100103 }
101104
102105 preHarvestChecks ( ) {
@@ -178,7 +181,8 @@ export class Aggregate extends AggregateBase {
178181 }
179182
180183 /** Stop running for the remainder of the page lifecycle */
181- abort ( ) {
184+ abort ( code ) {
185+ warn ( 60 , code )
182186 this . blocked = true
183187 this . mode = MODE . OFF
184188 this . agentRef . runtime . session . write ( { sessionTraceMode : this . mode } )
You can’t perform that action at this time.
0 commit comments