Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lmendoza/new relic #2342

Merged
merged 2 commits into from
Sep 3, 2024
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
65 changes: 65 additions & 0 deletions scripts/new-relic.postbuild.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions scripts/postbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { renameSync, readFileSync } from 'fs'
import { zendeskPlugin } from './zend-desk.postbuild'
import { createShareAssetsFolder } from './moveToShareFolder.postbuild'
import { robotsMetadata } from './robots-metada.postbuild'
import { newRelic } from './new-relic.postbuild'
const glob = require('glob')
// Run updates on index.html files across languages
glob
Expand All @@ -20,6 +21,7 @@ glob
let data = readFileSync(file, 'utf8')
data = uniqueLength(data, options)
data = buildInfo(data, options)
data = newRelic(data, options)
data = zendeskPlugin(data, options)
// Replace all the `*.js` references to match updated JS file names with the language code.
data = addLanguageCodeToHashesOnToHTMLFiles(data, options)
Expand Down
12 changes: 11 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { GoogleTagManagerService } from './core/google-tag-manager/google-tag-ma
import { TitleService } from './core/title-service/title.service'
import { ZendeskService } from './core/zendesk/zendesk.service'
import { ERROR_REPORT } from './errors'
import { TogglzService } from './core/togglz/togglz.service'
import { NewRelicService } from './core/new-relic/new-relic.service'

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -49,7 +51,9 @@ export class AppComponent {
private _userService: UserService,
private _errorHandler: ErrorHandlerService,
@Inject(WINDOW) private _window: Window,
_titleService: TitleService
_titleService: TitleService,
_togglzService: TogglzService,
_newRelicService: NewRelicService
) {
_titleService.init()
_platformInfo
Expand Down Expand Up @@ -81,6 +85,12 @@ export class AppComponent {
)
.subscribe()

_togglzService.getStateOf('NEW_RELIC_BROWSER_MONITORING').subscribe((value) => {
if (true) {
_newRelicService.init()
}
})

_router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
reportNavigationStart(event.url)
Expand Down
3 changes: 1 addition & 2 deletions src/app/cdk/platform-info/browserlist.regexp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// tslint:disable-next-line: max-line-length
export const BROWSERLIST_REGEXP =
/((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/
export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/
18 changes: 18 additions & 0 deletions src/app/core/new-relic/new-relic.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Inject, Injectable } from '@angular/core'
import { WINDOW } from 'src/app/cdk/window'

@Injectable({
providedIn: 'root',
})
export class NewRelicService {

constructor( @Inject(WINDOW) private window: Window,
) {}

public init() {
if ((window as any)?.newrelic?.start && typeof (window as any).newrelic.start === 'function' ) {
(window as any).newrelic.start()
}
}

}
1 change: 1 addition & 0 deletions src/environments/environment.local-with-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const environment = {
VERBOSE_SNACKBAR_ERRORS_REPORTS: true,
WORDPRESS_S3: 'https://homepage-qa.orcid.org',
WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org',
NEW_RELIC_APP: '772335827',
LANGUAGE_MENU_OPTIONS: {
ar: 'العربية',
cs: 'Čeština',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const environment = {
VERBOSE_SNACKBAR_ERRORS_REPORTS: true,
WORDPRESS_S3: 'https://homepage-qa.orcid.org',
WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org',
NEW_RELIC_APP: '772335827',
LANGUAGE_MENU_OPTIONS: {
ar: 'العربية',
cs: 'Čeština',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const environment = {
VERBOSE_SNACKBAR_ERRORS_REPORTS: false,
WORDPRESS_S3: 'https://homepage-prod.orcid.org',
WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org',
NEW_RELIC_APP: '772335825',
LANGUAGE_MENU_OPTIONS: {
ar: 'العربية',
cs: 'Čeština',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.qa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const environment = {
VERBOSE_SNACKBAR_ERRORS_REPORTS: true,
WORDPRESS_S3: 'https://homepage-qa.orcid.org',
WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org',
NEW_RELIC_APP: '772335827',
LANGUAGE_MENU_OPTIONS: {
ar: 'العربية',
cs: 'Čeština',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const environment = {
VERBOSE_SNACKBAR_ERRORS_REPORTS: false,
WORDPRESS_S3: 'https://homepage-prod.orcid.org',
WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org',
NEW_RELIC_APP: '772335828',
LANGUAGE_MENU_OPTIONS: {
ar: 'العربية',
cs: 'Čeština',
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" type="image/x-icon" href="./assets/icons/favicon.ico" />
<!-- NEW_RELIC_PLACEHOLDER -->
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
Expand Down
Loading