feat: log to new relic

This commit is contained in:
Shivam Mishra
2025-03-13 11:06:39 +05:30
parent 523291f5c3
commit 7ac40c8801
3 changed files with 37 additions and 0 deletions
@@ -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;
+16
View File
@@ -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({
@@ -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);
}
}