Skip to content

fabrix-app/spool-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spool-analytics

Gitter NPM version Build Status Test Coverage Dependency Status Follow @FabrixApp on Twitter

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'
    ]
  }
}