Skip to content

Commit b159211

Browse files
authored
chore: Update A2Q reporting for both agents in both environments (#1731)
1 parent e074d4f commit b159211

12 files changed

Lines changed: 164 additions & 30 deletions

.github/actions/build-agent2query/README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ The Agent2Query assets are used for testing the New Relic Browser Agent. This ac
1010

1111
The action generates the following files in `temp/agent-2-query/`:
1212

13-
- `released-config.js` - Configuration for the released version
14-
- `latest-config.js` - Configuration for the latest (dev) version
15-
- `released.html` - HTML test page for released version
16-
- `latest.html` - HTML test page for latest version
13+
- `latest-staging.html` - HTML test page for the latest (dev) staging version
14+
- `latest-staging-config.js` - Configuration for the latest staging version
15+
- `latest-us-prod.html` - HTML test page for the latest US production version
16+
- `latest-us-prod-config.js` - Configuration for the latest US production version
17+
- `released-staging.html` - HTML test page for the released staging version
18+
- `released-staging-config.js` - Configuration for the released staging version
19+
- `released-us-prod.html` - HTML test page for the released US production version
20+
- `released-us-prod-config.js` - Configuration for the released US production version
1721
- `events.js` - Event generation script
1822
- `square.png` - Static image asset (copied from source)
1923

@@ -25,28 +29,36 @@ See [this diagram](https://whimsical.com/6VcSPKQ9PqAQmWgnwM37cN) for information
2529
- name: Build Agent2Query assets
2630
uses: ./.github/actions/build-agent2query
2731
with:
28-
released_license_key: ${{ secrets.A2Q_RELEASED_LICENSE_KEY }}
29-
latest_license_key: ${{ secrets.A2Q_LATEST_LICENSE_KEY }}
32+
latest_staging_license_key: ${{ secrets.A2Q_LATEST_STAGING_LICENSE_KEY }}
33+
latest_us_prod_license_key: ${{ secrets.A2Q_LATEST_US_PROD_LICENSE_KEY }}
34+
released_staging_license_key: ${{ secrets.A2Q_RELEASED_STAGING_LICENSE_KEY }}
35+
released_us_prod_license_key: ${{ secrets.A2Q_RELEASED_US_PROD_LICENSE_KEY }}
3036
```
3137
3238
## Inputs
3339
34-
- `released_license_key` (required): License key for the released version
35-
- `latest_license_key` (required): License key for the latest version
40+
- `latest_staging_license_key` (required): License key for the latest staging version
41+
- `latest_us_prod_license_key` (required): License key for the latest US production version
42+
- `released_staging_license_key` (required): License key for the released staging version
43+
- `released_us_prod_license_key` (required): License key for the released US production version
3644

3745
## Required GitHub Secrets
3846

3947
The following secrets must be configured in the repository:
4048

41-
- `A2Q_RELEASED_LICENSE_KEY` - New Relic license key for released agent tests
42-
- `A2Q_LATEST_LICENSE_KEY` - New Relic license key for latest agent tests
49+
- `A2Q_LATEST_STAGING_LICENSE_KEY` - New Relic license key for latest staging agent tests
50+
- `A2Q_LATEST_US_PROD_LICENSE_KEY` - New Relic license key for latest US production agent tests
51+
- `A2Q_RELEASED_STAGING_LICENSE_KEY` - New Relic license key for released staging agent tests
52+
- `A2Q_RELEASED_US_PROD_LICENSE_KEY` - New Relic license key for released US production agent tests
4353

4454
## Template Files
4555

4656
Templates are located in `templates/` directory and use Handlebars syntax. The templates receive:
4757

48-
- `releasedLicenseKey` - The released version license key
49-
- `latestLicenseKey` - The latest version license key
58+
- `latestStagingLicenseKey` - The latest staging version license key
59+
- `latestUsProdLicenseKey` - The latest US production version license key
60+
- `releasedStagingLicenseKey` - The released staging version license key
61+
- `releasedUsProdLicenseKey` - The released US production version license key
5062

5163
## Output
5264

.github/actions/build-agent2query/action.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ name: 'Build Agent2Query Assets'
22
description: 'Builds Agent2Query test assets with templated license keys'
33

44
inputs:
5-
released_license_key:
6-
description: 'License key for the released version'
5+
latest_staging_license_key:
6+
description: 'License key for the latest staging version'
77
required: true
8-
latest_license_key:
9-
description: 'License key for the latest version'
8+
latest_us_prod_license_key:
9+
description: 'License key for the latest US production version'
10+
required: true
11+
released_staging_license_key:
12+
description: 'License key for the released staging version'
13+
required: true
14+
released_us_prod_license_key:
15+
description: 'License key for the released US production version'
1016
required: true
1117

1218
runs:
@@ -18,6 +24,8 @@ runs:
1824
- name: Build Agent2Query assets
1925
run: |
2026
node $GITHUB_ACTION_PATH/index.js \
21-
--released-license-key "${{ inputs.released_license_key }}" \
22-
--latest-license-key "${{ inputs.latest_license_key }}"
27+
--latest-staging-license-key "${{ inputs.latest_staging_license_key }}" \
28+
--latest-us-prod-license-key "${{ inputs.latest_us_prod_license_key }}" \
29+
--released-staging-license-key "${{ inputs.released_staging_license_key }}" \
30+
--released-us-prod-license-key "${{ inputs.released_us_prod_license_key }}"
2331
shell: bash

.github/actions/build-agent2query/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ process.argv.slice(2).forEach((arg, index, array) => {
1818
}
1919
})
2020

21-
const releasedLicenseKey = args['released-license-key']
22-
const latestLicenseKey = args['latest-license-key']
21+
const latestStagingLicenseKey = args['latest-staging-license-key']
22+
const latestUsProdLicenseKey = args['latest-us-prod-license-key']
23+
const releasedStagingLicenseKey = args['released-staging-license-key']
24+
const releasedUsProdLicenseKey = args['released-us-prod-license-key']
2325

24-
if (!releasedLicenseKey || !latestLicenseKey) {
25-
throw new Error('Both --released-license-key and --latest-license-key are required')
26+
if (!latestStagingLicenseKey || !latestUsProdLicenseKey || !releasedStagingLicenseKey || !releasedUsProdLicenseKey) {
27+
throw new Error('All license keys are required: --latest-staging-license-key, --latest-us-prod-license-key, --released-staging-license-key, --released-us-prod-license-key')
2628
}
2729

2830
// Ensure the output directory exists
@@ -42,8 +44,10 @@ for (const file of templateFiles) {
4244
const template = Handlebars.compile(templateContent)
4345

4446
const result = template({
45-
releasedLicenseKey,
46-
latestLicenseKey
47+
latestStagingLicenseKey,
48+
latestUsProdLicenseKey,
49+
releasedStagingLicenseKey,
50+
releasedUsProdLicenseKey
4751
})
4852

4953
await fs.promises.writeFile(outputPath, result, { encoding: 'utf-8' })

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ NREUM.init = {
3434
}
3535
}
3636
NREUM.feature_flags = ['soft_nav', 'websockets']
37-
NREUM.info = { beacon: 'staging-bam-cell.nr-data.net', errorBeacon: 'staging-bam-cell.nr-data.net', licenseKey: '{{{latestLicenseKey}}}', applicationID: '77606036', sa: 1 }
37+
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.html renamed to .github/actions/build-agent2query/templates/latest-staging.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>A2Q Test Page - Latest</title>
7-
<script src="./latest-config.js"></script>
7+
<script src="./latest-staging-config.js"></script>
88
<script src="https://js-agent.newrelic.com/dev/nr-loader-spa.min.js"></script>
99
</head>
1010
<body>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ NREUM.init = {
3434
}
3535
}
3636
NREUM.feature_flags = ['soft_nav', 'websockets']
37-
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{releasedLicenseKey}}}', applicationID: '1431909786', sa: 1 }
37+
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{latestUsProdLicenseKey}}}', applicationID: '1431915022', sa: 1 }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>A2Q Test Page - Latest</title>
7+
<script src="./latest-us-prod-config.js"></script>
8+
<script src="https://js-agent.newrelic.com/dev/nr-loader-spa.min.js"></script>
9+
</head>
10+
<body>
11+
<h1>A2Q Test Page</h1>
12+
<p>This page is used for testing the New Relic Browser Agent with Agent2Query. It should capture 1 of every event the agent generates.</p>
13+
<!-- page resources -->
14+
<img src="./square.png" />
15+
<script src="./events.js"></script>
16+
</body>
17+
</html>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* eslint-disable */
2+
// eslint-disable-file
3+
window.localStorage.clear()
4+
window.NREUM || (NREUM = {})
5+
NREUM.init = {
6+
session_replay: {
7+
enabled: true,
8+
block_selector: '',
9+
mask_text_selector: '*',
10+
sampling_rate: 100.0,
11+
error_sampling_rate: 100.0,
12+
mask_all_inputs: true,
13+
collect_fonts: true,
14+
inline_images: false,
15+
inline_stylesheet: true,
16+
fix_stylesheets: true,
17+
preload: false,
18+
mask_input_options: {}
19+
},
20+
distributed_tracing: {
21+
enabled: true
22+
},
23+
performance: {
24+
capture_marks: true, capture_measures: true
25+
},
26+
browser_consent_mode: {
27+
enabled: false
28+
},
29+
privacy: {
30+
cookies_enabled: true
31+
},
32+
ajax: {
33+
deny_list: ['staging-bam-cell.nr-data.net']
34+
}
35+
}
36+
NREUM.feature_flags = ['soft_nav', 'websockets']
37+
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.html renamed to .github/actions/build-agent2query/templates/released-staging.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>A2Q Test Page - Released</title>
7-
<script src="./released-config.js"></script>
7+
<script src="./released-staging-config.js"></script>
88
<script src="https://js-agent.newrelic.com/nr-loader-spa-1.x.x.min.js"></script>
99
</head>
1010
<body>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* eslint-disable */
2+
// eslint-disable-file
3+
window.localStorage.clear()
4+
window.NREUM || (NREUM = {})
5+
NREUM.init = {
6+
session_replay: {
7+
enabled: true,
8+
block_selector: '',
9+
mask_text_selector: '*',
10+
sampling_rate: 100.0,
11+
error_sampling_rate: 100.0,
12+
mask_all_inputs: true,
13+
collect_fonts: true,
14+
inline_images: false,
15+
inline_stylesheet: true,
16+
fix_stylesheets: true,
17+
preload: false,
18+
mask_input_options: {}
19+
},
20+
distributed_tracing: {
21+
enabled: true
22+
},
23+
performance: {
24+
capture_marks: true, capture_measures: true
25+
},
26+
browser_consent_mode: {
27+
enabled: false
28+
},
29+
privacy: {
30+
cookies_enabled: true
31+
},
32+
ajax: {
33+
deny_list: ['bam.nr-data.net']
34+
}
35+
}
36+
NREUM.feature_flags = ['soft_nav', 'websockets']
37+
NREUM.info = { beacon: 'bam.nr-data.net', errorBeacon: 'bam.nr-data.net', licenseKey: '{{{releasedUsProdLicenseKey}}}', applicationID: '1431909786', sa: 1 }

0 commit comments

Comments
 (0)