src/lib/metrics.js
/**
   * Add a metric to the store
   */
Add a metric to the store
Add a metric to the store
add(metric) {
    const series = seriesFor(metric);
    const s = encode(series);
    if (!this.series[s]) {
      this.series[s] = [];
      this.indices = series.entrySeq().reduce((indices, e) => {
        return indices.updateIn(e, Set(), seriesSet => seriesSet.add(s));
      }, this.indices);
    }
    insertOrReplacePoint(
      this.series[s],
      metric.get('time'),
      metric.get('value')
    );
    return metric;
  }
add ( metric ) { const series = seriesFor ( metric ) ; const s = encode ( series ) ; if ( ! this . series [ s ] ) { this . series [ s ] = [ ] ; this . indices = series . entrySeq ( ) . reduce ( ( indices , e ) => { return indices . updateIn ( e , Set ( ) , seriesSet => seriesSet . add ( s ) ) ; } , this . indices ) ; } insertOrReplacePoint ( this . series [ s ] , metric . get ( 'time' ) , metric . get ( 'value' ) ) ; return metric ; }
Add a metric to the store
Add a metric to the store
// create the time series // and index it