Skip to content

Commit 4fb40eb

Browse files
committed
fix(new-relic): added new relic setup
1 parent 9e0e80f commit 4fb40eb

File tree

12 files changed

+326
-13
lines changed

12 files changed

+326
-13
lines changed

package-lock.json

Lines changed: 100 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@citation-js/core": "^0.7.18",
4545
"@citation-js/plugin-csl": "^0.7.18",
4646
"@fortawesome/fontawesome-free": "^6.7.2",
47+
"@newrelic/browser-agent": "^1.301.0",
4748
"@ngx-translate/core": "^16.0.4",
4849
"@ngx-translate/http-loader": "^16.0.1",
4950
"@ngxs/devtools-plugin": "^19.0.0",

src/app/core/provider/application.initialization.provider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { OSFConfigService } from '@core/services/osf-config.service';
44

55
import { ENVIRONMENT } from './environment.provider';
66

7+
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent';
78
import * as Sentry from '@sentry/angular';
89
import { GoogleTagManagerConfiguration } from 'angular-google-tag-manager';
910

@@ -25,6 +26,7 @@ export function initializeApplication() {
2526
await configService.load();
2627

2728
const googleTagManagerId = environment.googleTagManagerId;
29+
2830
if (googleTagManagerId) {
2931
googleTagManagerConfiguration.set({ id: googleTagManagerId });
3032
}
@@ -41,6 +43,12 @@ export function initializeApplication() {
4143
integrations: [],
4244
});
4345
}
46+
47+
const { enabled, ...newRelicConfig } = environment.newRelic;
48+
49+
if (enabled) {
50+
new BrowserAgent(newRelicConfig);
51+
}
4452
};
4553
}
4654

src/app/shared/models/environment.model.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface EnvironmentModel {
1313
defaultProvider: string;
1414
dataciteTrackerRepoId: string | null;
1515
dataciteTrackerAddress: string;
16-
16+
newRelic: NewRelicConfig;
1717
activityLogs?: {
1818
pageSize?: number;
1919
};
@@ -50,3 +50,27 @@ export interface EnvironmentModel {
5050
*/
5151
googleFilePickerAppId: number;
5252
}
53+
54+
interface NewRelicConfig {
55+
enabled: boolean;
56+
init: {
57+
distributed_tracing: { enabled: boolean };
58+
performance: { capture_measures: boolean };
59+
privacy: { cookies_enabled: boolean };
60+
ajax: { deny_list: string[] };
61+
};
62+
info: {
63+
beacon: string;
64+
errorBeacon: string;
65+
licenseKey: string;
66+
applicationID: string;
67+
sa: number;
68+
};
69+
loader_config: {
70+
accountID: string;
71+
trustKey: string;
72+
agentID: string;
73+
licenseKey: string;
74+
applicationID: string;
75+
};
76+
}

src/assets/config/template.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
{
22
"webUrl": "",
33
"apiDomainUrl": "",
4+
"shareTroveUrl": "",
45
"addonsApiUrl": "",
6+
"funderApiUrl": "",
57
"casUrl": "",
68
"recaptchaSiteKey": "",
7-
"dataciteTrackerRepoId": "",
9+
"dataciteTrackerRepoId": null,
10+
"dataciteTrackerAddress": "",
811
"sentryDsn": "",
912
"googleTagManagerId": "",
1013
"googleFilePickerApiKey": "",
11-
"googleFilePickerAppId": 0
14+
"googleFilePickerAppId": 0,
15+
"newRelic": {
16+
"enabled": false,
17+
"init": {
18+
"distributed_tracing": { "enabled": false },
19+
"performance": { "capture_measures": false },
20+
"privacy": { "cookies_enabled": true },
21+
"ajax": { "deny_list": [""] }
22+
},
23+
"info": {
24+
"beacon": "",
25+
"errorBeacon": "",
26+
"licenseKey": "",
27+
"applicationID": "",
28+
"sa": 1
29+
},
30+
"loader_config": {
31+
"accountID": "",
32+
"trustKey": "",
33+
"agentID": "",
34+
"licenseKey": "",
35+
"applicationID": ""
36+
}
37+
}
1238
}

src/environments/environment.development.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ export const environment = {
1313
/**
1414
* Base URL of the OSF web application.
1515
*/
16-
webUrl: 'https://staging4.osf.io',
16+
webUrl: 'https://staging3.osf.io',
1717
/**
1818
* Domain URL used for JSON:API v2 services.
1919
*/
20-
apiDomainUrl: 'https://api.staging4.osf.io',
20+
apiDomainUrl: 'https://api.staging3.osf.io',
2121
/**
2222
* Base URL for SHARE discovery search (Trove).
2323
*/
2424
shareTroveUrl: 'https://staging-share.osf.io/trove',
2525
/**
2626
* URL for the OSF Addons API (v1).
2727
*/
28-
addonsApiUrl: 'https://addons.staging4.osf.io/v1',
28+
addonsApiUrl: 'https://addons.staging3.osf.io/v1',
2929
/**
3030
* API endpoint for funder metadata resolution via Crossref.
3131
*/
3232
funderApiUrl: 'https://api.crossref.org/',
3333
/**
3434
* URL for OSF Central Authentication Service (CAS).
3535
*/
36-
casUrl: 'https://accounts.staging4.osf.io',
36+
casUrl: 'https://accounts.staging3.osf.io',
3737
/**
3838
* Site key used for reCAPTCHA v2 validation in staging.
3939
*/
@@ -56,4 +56,27 @@ export const environment = {
5656
defaultProvider: 'osf',
5757
dataciteTrackerRepoId: null,
5858
dataciteTrackerAddress: 'https://analytics.datacite.org/api/metric',
59+
newRelic: {
60+
enabled: false,
61+
init: {
62+
distributed_tracing: { enabled: true },
63+
performance: { capture_measures: true },
64+
privacy: { cookies_enabled: true },
65+
ajax: { deny_list: ['bam.nr-data.net'] },
66+
},
67+
info: {
68+
beacon: 'bam.nr-data.net',
69+
errorBeacon: 'bam.nr-data.net',
70+
licenseKey: '704513e63b',
71+
applicationID: '1835137194',
72+
sa: 1,
73+
},
74+
loader_config: {
75+
accountID: '772413',
76+
trustKey: '772413',
77+
agentID: '1835137194',
78+
licenseKey: '704513e63b',
79+
applicationID: '1835137194',
80+
},
81+
},
5982
};

src/environments/environment.docker.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,31 @@ export const environment = {
1313
defaultProvider: 'osf',
1414
dataciteTrackerRepoId: null,
1515
dataciteTrackerAddress: 'https://analytics.datacite.org/api/metric',
16+
newRelic: {
17+
enabled: false,
18+
init: {
19+
distributed_tracing: { enabled: false },
20+
performance: { capture_measures: false },
21+
privacy: { cookies_enabled: true },
22+
ajax: { deny_list: ['bam.nr-data.net'] },
23+
},
24+
info: {
25+
beacon: 'bam.nr-data.net',
26+
errorBeacon: 'bam.nr-data.net',
27+
licenseKey: '704513e63b',
28+
applicationID: '1835137194',
29+
sa: 1,
30+
},
31+
loader_config: {
32+
accountID: '772413',
33+
trustKey: '772413',
34+
agentID: '1835137194',
35+
licenseKey: '704513e63b',
36+
applicationID: '1835137194',
37+
},
38+
},
39+
sentryDsn: '',
40+
googleTagManagerId: '',
41+
googleFilePickerApiKey: '',
42+
googleFilePickerAppId: 0,
1643
};

0 commit comments

Comments
 (0)