mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
chore: add telemetry logs
This commit is contained in:
parent
7d75a25dd2
commit
78397648d1
@ -1,4 +1,6 @@
|
||||
import frappe from 'frappe';
|
||||
import telemetry from '../src/telemetry/telemetry';
|
||||
import { Verb } from '../src/telemetry/types';
|
||||
import { getSavePath, saveData, showExportInFolder } from '../src/utils';
|
||||
|
||||
function templateToInnerText(innerHTML) {
|
||||
@ -80,13 +82,15 @@ async function exportReport(extention, reportName, getReportData) {
|
||||
switch (extention) {
|
||||
case 'csv':
|
||||
await exportCsv(rows, columns, filePath);
|
||||
return;
|
||||
break;
|
||||
case 'json':
|
||||
await exportJson(rows, columns, filePath, filters, reportName);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
telemetry.log(Verb.Exported, reportName, { extention });
|
||||
}
|
||||
|
||||
export default function getCommonExportActions(reportName) {
|
||||
|
@ -2,6 +2,8 @@ import { Doc, Field, FieldType, Map } from '@/types/model';
|
||||
import frappe from 'frappe';
|
||||
import { isNameAutoSet } from 'frappe/model/naming';
|
||||
import { parseCSV } from './csvParser';
|
||||
import telemetry from './telemetry/telemetry';
|
||||
import { Noun, Verb } from './telemetry/types';
|
||||
|
||||
export const importable = [
|
||||
'SalesInvoice',
|
||||
@ -387,6 +389,12 @@ export class Importer {
|
||||
setLoadingStatus(true, entriesMade, docObjs.length);
|
||||
} catch (err) {
|
||||
setLoadingStatus(false, entriesMade, docObjs.length);
|
||||
|
||||
telemetry.log(Verb.Imported, this.doctype as Noun, {
|
||||
success: false,
|
||||
count: entriesMade,
|
||||
});
|
||||
|
||||
return this.handleError(doc, err as Error, status);
|
||||
}
|
||||
|
||||
@ -395,6 +403,11 @@ export class Importer {
|
||||
|
||||
setLoadingStatus(false, entriesMade, docObjs.length);
|
||||
status.success = true;
|
||||
|
||||
telemetry.log(Verb.Imported, this.doctype as Noun, {
|
||||
success: true,
|
||||
count: entriesMade,
|
||||
});
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import postStart, { setCurrencySymbols } from '../server/postStart';
|
||||
import { DB_CONN_FAILURE } from './messages';
|
||||
import runMigrate from './migrate';
|
||||
import { getId } from './telemetry/helpers';
|
||||
import telemetry from './telemetry/telemetry';
|
||||
import { callInitializeMoneyMaker, getSavePath } from './utils';
|
||||
|
||||
export async function createNewDatabase() {
|
||||
@ -95,6 +96,7 @@ export async function connectToLocalDatabase(filePath) {
|
||||
|
||||
// second init with currency, normal usage
|
||||
await callInitializeMoneyMaker();
|
||||
telemetry.start();
|
||||
return { connectionSuccess: true, reason: '' };
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,8 @@ import QuickEditForm from '@/pages/QuickEditForm';
|
||||
import Report from '@/pages/Report';
|
||||
import Settings from '@/pages/Settings/Settings';
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import telemetry from './telemetry/telemetry';
|
||||
import { NounEnum, Verb } from './telemetry/types';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@ -114,6 +116,11 @@ const routes = [
|
||||
|
||||
let router = createRouter({ routes, history: createWebHistory() });
|
||||
|
||||
router.afterEach((to, from, failure) => {
|
||||
const more = { from: from.fullPath, to: to.fullPath };
|
||||
telemetry.log(Verb.Navigated, NounEnum.Route, more);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
window.router = router;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user