Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/build-ab/templates/latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ window.NREUM.loader_config.licenseKey = '{{{args.abLicenseKey}}}'
window.NREUM.info.applicationID = '{{{args.abAppId}}}'
window.NREUM.info.licenseKey = '{{{args.abLicenseKey}}}'
window.NREUM.init.proxy.assets = 'https://staging-js-agent.newrelic.com/dev'
window.NREUM.init.feature_flags = ['ajax_metrics_deny_list', 'register', 'websockets']
window.NREUM.init.feature_flags = ['ajax_metrics_deny_list', 'register']
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
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
window.NREUM.init.web_sockets.enabled = true
window.NREUM.init.user_actions = {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
window.NREUM.init.ajax.capture_payloads = 'failures'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NREUM.init = {
},
ajax: {
deny_list: ['staging-bam-cell.nr-data.net']
},
web_sockets: {
enabled: true
}
}
NREUM.feature_flags = ['soft_nav', 'websockets']
NREUM.feature_flags = ['soft_nav']
NREUM.info = { beacon: 'staging-bam-cell.nr-data.net', errorBeacon: 'staging-bam-cell.nr-data.net', licenseKey: '{{{latestStagingLicenseKey}}}', applicationID: '77606036', sa: 1 }
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NREUM.init = {
},
ajax: {
deny_list: ['bam.nr-data.net']
},
web_sockets: {
enabled: true
}
}
NREUM.feature_flags = ['soft_nav', 'websockets']
NREUM.feature_flags = ['soft_nav']
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{latestUsProdLicenseKey}}}', applicationID: '1431915022', sa: 1 }
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NREUM.init = {
},
ajax: {
deny_list: ['staging-bam-cell.nr-data.net']
},
web_sockets: {
enabled: true
}
}
NREUM.feature_flags = ['soft_nav', 'websockets']
NREUM.feature_flags = ['soft_nav']
NREUM.info = { beacon: 'staging-bam-cell.nr-data.net', errorBeacon: 'staging-bam-cell.nr-data.net', licenseKey: '{{{releasedStagingLicenseKey}}}', applicationID: '78536307', sa: 1 }
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NREUM.init = {
},
ajax: {
deny_list: ['bam.nr-data.net']
},
web_sockets: {
enabled: true
}
}
NREUM.feature_flags = ['soft_nav', 'websockets']
NREUM.feature_flags = ['soft_nav']
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{releasedUsProdLicenseKey}}}', applicationID: '1431909786', sa: 1 }
5 changes: 4 additions & 1 deletion .github/actions/internal-promotion/templates/released.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@
}
},
proxy: {},
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']},
web_sockets: {
enabled: true
}
},
loader_config: {
accountID: '1',
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-experiment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ jobs:
}
},
proxy: {},
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']}
user_actions: {elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title']},
web_sockets: {
enabled: true
}
};
window.NREUM.loader_config = {
accountID: '1',
Expand Down
2 changes: 2 additions & 0 deletions src/common/config/init-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
* @property {Object} [user_actions]
* @property {boolean} [user_actions.enabled] - Must be true to allow UserAction events to be captured.
* @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.
* @property {Object} [web_sockets]
* @property {boolean} [web_sockets.enabled] - Turn on/off the web sockets feature (off by default).
*/

export default {}
3 changes: 2 additions & 1 deletion src/common/config/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ const InitModelFn = () => {
session_trace: { enabled: true, autoStart: true },
soft_navigations: { enabled: true, autoStart: true },
ssl: undefined,
user_actions: { enabled: true, elementAttributes: ['id', 'className', 'tagName', 'type'] }
user_actions: { enabled: true, elementAttributes: ['id', 'className', 'tagName', 'type'] },
web_sockets: { enabled: false }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/features/generic_events/aggregate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class Aggregate extends AggregateBase {
this.addEvent(event, target)
}, this.featureName, this.ee)

if (agentRef.init.feature_flags.includes('websockets')) {
if (agentRef.init.feature_flags.includes('websockets') || agentRef.init.web_sockets?.enabled) {
registerHandler('ws-complete', (nrData) => {
const event = {
...nrData,
Expand Down
2 changes: 1 addition & 1 deletion src/features/generic_events/instrument/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Instrument extends InstrumentBase {
static featureName = FEATURE_NAME
constructor (agentRef) {
super(agentRef, FEATURE_NAME)
const websocketsEnabled = agentRef.init.feature_flags.includes('websockets')
const websocketsEnabled = agentRef.init.feature_flags.includes('websockets') || agentRef.init.web_sockets?.enabled
const securityPolicyViolationEnabled = !agentRef.init.feature_flags.includes('no_spv')

/** config values that gate whether the generic events aggregator should be imported at all */
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/websocket-error.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>WebSocket Error Linkage Test</title>
{init} {config}
<script>
NREUM.init.feature_flags = ['websockets']
NREUM.init.web_sockets = { enabled: true }
</script>
{loader}
<script>
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/websocket-multi-send-msg.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>WebSocket Multi-Type Send/Receive Test</title>
{init} {config}
<script>
NREUM.init.feature_flags = ['websockets']
NREUM.init.web_sockets = { enabled: true }
</script>
{loader}
<script>
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/websockets.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>RUM Unit Test</title>
{init} {config}
<script>
NREUM.init.feature_flags = ['websockets']
NREUM.init.web_sockets = { enabled: true }
</script>
{loader}
<script>
Expand Down
3 changes: 2 additions & 1 deletion tests/components/generic_events/instrument/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ describe('generic events sub-features', () => {
mainAgent.init.page_action.enabled = false
mainAgent.init.user_actions.enabled = false
mainAgent.init.performance = { capture_marks: false, capture_measures: false, resources: { enabled: false } }
mainAgent.init.feature_flags = ['websockets', 'no_spv']
mainAgent.init.web_sockets = { enabled: true }
mainAgent.init.feature_flags = ['no_spv']

const genericEventsInstrument = new GenericEvents(mainAgent)
await new Promise(process.nextTick)
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/ins/websockets.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe.withBrowsersMatching(supportsWebSocketsTesting)('WebSocket wrapper', ()
// Load a simple instrumented page with websockets feature enabled
const url = await browser.testHandle.assetURL('instrumented.html', {
loader: 'spa',
init: { feature_flags: ['websockets'] }
init: { web_sockets: { enabled: true } }
})
await browser.url(url).then(() => browser.waitForAgentLoad())

Expand Down
9 changes: 7 additions & 2 deletions tests/unit/common/config/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jest.mock('../../../../src/common/util/console.js')

test('init props exist and return expected defaults', () => {
const config = mergeInit({})
expect(Object.keys(config).length).toEqual(23)
expect(Object.keys(config).length).toEqual(24)
expect(config.ajax).toEqual({
autoStart: true,
block_internal: true,
Expand Down Expand Up @@ -130,7 +130,12 @@ test('init props exist and return expected defaults', () => {
enabled: true,
elementAttributes: ['id', 'className', 'tagName', 'type']
})
expect(config.browser_consent_mode.enabled).toEqual(false)
expect(config.browser_consent_mode).toEqual({
enabled: false
})
expect(config.web_sockets).toEqual({
enabled: false
})
})

describe('property getters/setters used for validation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const opts = {
info: NREUM.info,
init: {
...NREUM.init,
feature_flags: ['websockets']
web_sockets: { enabled: true }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/test-builds/library-wrapper/src/robust-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const opts = {
info: NREUM.info,
init: {
...NREUM.init,
feature_flags: ['websockets']
web_sockets: { enabled: true }
}
}

Expand Down
Loading