diff --git a/app/javascript/dashboard/store/modules/conversations/index.js b/app/javascript/dashboard/store/modules/conversations/index.js index e77d057ce..4cafd8c46 100644 --- a/app/javascript/dashboard/store/modules/conversations/index.js +++ b/app/javascript/dashboard/store/modules/conversations/index.js @@ -229,6 +229,15 @@ export const mutations = { Sentry.captureMessage('Conversation update mismatch'); }); + window.logrelic( + `conversation update mismatch with incoming ${conversation} and stored ${selectedConversation}`, + { + customAttributes: { + conversation_id: conversation.id, + }, + } + ); + return; } @@ -245,6 +254,15 @@ export const mutations = { Sentry.captureMessage('Conversation update overlap'); }); + + window.logrelic( + `conversation update overlap with incoming ${conversation} and stored ${selectedConversation}`, + { + customAttributes: { + conversation_id: conversation.id, + }, + } + ); } const { messages, ...updates } = conversation; diff --git a/app/javascript/entrypoints/dashboard.js b/app/javascript/entrypoints/dashboard.js index a2184d074..79fcdbc2f 100644 --- a/app/javascript/entrypoints/dashboard.js +++ b/app/javascript/entrypoints/dashboard.js @@ -21,6 +21,9 @@ import router, { initalizeRouter } from 'dashboard/routes'; import store from 'dashboard/store'; import constants from 'dashboard/constants/globals'; import * as Sentry from '@sentry/vue'; +import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent'; +import { Logging } from '@newrelic/browser-agent/features/logging'; + import { initializeAnalyticsEvents, initializeChatwootEvents, @@ -47,6 +50,19 @@ app.use(i18n); app.use(store); app.use(router); +window.startNewRelic = options => { + return new BrowserAgent({ + ...options, + features: [Logging], + }); +}; + +window.logrelic = (message, options = {}) => { + if (window.newrelic) { + window.newrelic.log(message, { level: 'debug' }, options); + } +}; + // [VITE] Disabled this, need to renable later if (window.errorLoggingConfig) { Sentry.init({ diff --git a/app/javascript/shared/helpers/BaseActionCableConnector.js b/app/javascript/shared/helpers/BaseActionCableConnector.js index 3eb61a80a..131e351b3 100644 --- a/app/javascript/shared/helpers/BaseActionCableConnector.js +++ b/app/javascript/shared/helpers/BaseActionCableConnector.js @@ -82,6 +82,9 @@ class BaseActionCableConnector { onReceived = ({ event, data } = {}) => { if (this.isAValidEvent(data)) { if (this.events[event] && typeof this.events[event] === 'function') { + window.logrelic( + `processing actioncable ${event} with ${data} at ${Number(Date.now())}` + ); this.events[event](data); } }