Skip to content

Commit aa4d2f3

Browse files
authored
feat: Add websocket init config (#1803)
1 parent 52d3ff1 commit aa4d2f3

19 files changed

Lines changed: 47 additions & 19 deletions

File tree

.github/actions/build-ab/templates/latest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ window.NREUM.loader_config.licenseKey = '{{{args.abLicenseKey}}}'
44
window.NREUM.info.applicationID = '{{{args.abAppId}}}'
55
window.NREUM.info.licenseKey = '{{{args.abLicenseKey}}}'
66
window.NREUM.init.proxy.assets = 'https://staging-js-agent.newrelic.com/dev'
7-
window.NREUM.init.feature_flags = ['ajax_metrics_deny_list', 'register', 'websockets']
7+
window.NREUM.init.feature_flags = ['ajax_metrics_deny_list', 'register']
88
window.NREUM.init.session_replay.enabled = true // feature is enabled, but the app settings will have sampling at 0. We can proactively enable SR for certain test cases through app settings
99
window.NREUM.init.session_trace.enabled = true // feature is enabled, but the app settings will have sampling at 0. We can proactively enable SR for certain test cases through app settings
10+
window.NREUM.init.web_sockets.enabled = true
1011
window.NREUM.init.user_actions = {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
1112
window.NREUM.init.ajax.capture_payloads = 'failures'
1213

.github/actions/build-agent2query/templates/latest-staging-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ NREUM.init = {
3131
},
3232
ajax: {
3333
deny_list: ['staging-bam-cell.nr-data.net']
34+
},
35+
web_sockets: {
36+
enabled: true
3437
}
3538
}
36-
NREUM.feature_flags = ['soft_nav', 'websockets']
39+
NREUM.feature_flags = ['soft_nav']
3740
NREUM.info = { beacon: 'staging-bam-cell.nr-data.net', errorBeacon: 'staging-bam-cell.nr-data.net', licenseKey: '{{{latestStagingLicenseKey}}}', applicationID: '77606036', sa: 1 }

.github/actions/build-agent2query/templates/latest-us-prod-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ NREUM.init = {
3131
},
3232
ajax: {
3333
deny_list: ['bam.nr-data.net']
34+
},
35+
web_sockets: {
36+
enabled: true
3437
}
3538
}
36-
NREUM.feature_flags = ['soft_nav', 'websockets']
39+
NREUM.feature_flags = ['soft_nav']
3740
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{latestUsProdLicenseKey}}}', applicationID: '1431915022', sa: 1 }

.github/actions/build-agent2query/templates/released-staging-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ NREUM.init = {
3131
},
3232
ajax: {
3333
deny_list: ['staging-bam-cell.nr-data.net']
34+
},
35+
web_sockets: {
36+
enabled: true
3437
}
3538
}
36-
NREUM.feature_flags = ['soft_nav', 'websockets']
39+
NREUM.feature_flags = ['soft_nav']
3740
NREUM.info = { beacon: 'staging-bam-cell.nr-data.net', errorBeacon: 'staging-bam-cell.nr-data.net', licenseKey: '{{{releasedStagingLicenseKey}}}', applicationID: '78536307', sa: 1 }

.github/actions/build-agent2query/templates/released-us-prod-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ NREUM.init = {
3131
},
3232
ajax: {
3333
deny_list: ['bam.nr-data.net']
34+
},
35+
web_sockets: {
36+
enabled: true
3437
}
3538
}
36-
NREUM.feature_flags = ['soft_nav', 'websockets']
39+
NREUM.feature_flags = ['soft_nav']
3740
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{releasedUsProdLicenseKey}}}', applicationID: '1431909786', sa: 1 }

.github/actions/internal-promotion/templates/released.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@
8585
}
8686
},
8787
proxy: {},
88-
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
88+
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']},
89+
web_sockets: {
90+
enabled: true
91+
}
8992
},
9093
loader_config: {
9194
accountID: '1',

.github/workflows/publish-experiment.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ jobs:
112112
}
113113
},
114114
proxy: {},
115-
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
115+
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']},
116+
web_sockets: {
117+
enabled: true
118+
}
116119
};
117120
window.NREUM.loader_config = {
118121
accountID: '1',

src/common/config/init-types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
* @property {Object} [user_actions]
8989
* @property {boolean} [user_actions.enabled] - Must be true to allow UserAction events to be captured.
9090
* @property {Array<string>} [user_actions.elementAttributes] - List of HTML Element properties to be captured with UserAction events' target elements. This may help to identify the source element being interacted with in the UI.
91+
* @property {Object} [web_sockets]
92+
* @property {boolean} [web_sockets.enabled] - Turn on/off the web sockets feature (off by default).
9193
*/
9294

9395
export default {}

src/common/config/init.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ const InitModelFn = () => {
138138
session_trace: { enabled: true, autoStart: true },
139139
soft_navigations: { enabled: true, autoStart: true },
140140
ssl: undefined,
141-
user_actions: { enabled: true, elementAttributes: ['id', 'className', 'tagName', 'type'] }
141+
user_actions: { enabled: true, elementAttributes: ['id', 'className', 'tagName', 'type'] },
142+
web_sockets: { enabled: false }
142143
}
143144
}
144145

src/features/generic_events/aggregate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class Aggregate extends AggregateBase {
251251
this.addEvent(event, target)
252252
}, this.featureName, this.ee)
253253

254-
if (agentRef.init.feature_flags.includes('websockets')) {
254+
if (agentRef.init.feature_flags.includes('websockets') || agentRef.init.web_sockets?.enabled) {
255255
registerHandler('ws-complete', (nrData) => {
256256
const event = {
257257
...nrData,

0 commit comments

Comments
 (0)