spool-analytics
Analytics for Fabrix Apps.
Take a snap shot of a data set for later analysis.
Install
$ npm install --save @fabrix/spool-analytics
Configure
Add the spool
// config/main.js
import { AnalyticsSpool } from '@fabrix/spool-analytics'
import { CronsSpool } from '@fabrix/spool-crons'
export const main = {
spools: [
// ... other spools
CronsSpool,
AnalyticsSpool
]
}
Configure Analytics
// config/analytics.ts
export const analytics = {
prefix: '/api/v1',
profile: 'testProfile',
config: {
profiles: {
testProfile: [
'TestAnalytic.test',
'TestAnalytic.minuteTest',
'TestAnalytic.hourTest',
'TestAnalytic.dayTest',
'TestAnalytic.weekTest',
'TestAnalytic.monthTest',
'TestAnalytic.quarterTest',
'TestAnalytic.yearTest'
]
},
frequency: {
minute: [
'TestAnalytic.minuteTest'
],
hour: [
'TestAnalytic.hourTest'
],
day: [
'TestAnalytic.dayTest'
],
week: [
'TestAnalytic.weekTest'
],
month: [
'TestAnalytic.monthTest'
],
quarter: [
'TestAnalytic.quarterTest'
],
year: [
'TestAnalytic.yearTest'
]
}
}
}
Configure the crons spool to run the analytic crons
// config/crons.ts
export const crons = {
prefix: '/api/v1',
live_mode: false,
profile: 'testProfile',
profiles: {
testProfile: [
'AnalyticsCron.minute',
'AnalyticsCron.hour',
'AnalyticsCron.day',
'AnalyticsCron.week',
'AnalyticsCron.month',
'AnalyticsCron.quarter',
'AnalyticsCron.year'
]
}
}