WiserSolutions/quadro

Allow logging counters

igorshapiro opened this issue · 0 comments

Useful for metrics with high dimension cardinality (for example if we have 1000 possible values for each dimension) that we don't want to send to a datadog.

Pushing it to ELK will allow better visibility into different metrics.

Also addresses #12

Proposed API:

const visitsMetric = Q.log.createMetric('visits')
visitsMetric.increment({ accountId: ..., userAgent: ... })

The expected behavior is that the records written to datastore (ELK) will be pre-aggregated:

{ 
  "metric": { "name": "visits", "value": 100 }, 
  "dimensions": { "accountId": 1, "userAgent": "userAgent1" } 
}
{ 
  "metric": { "name": "visits", "value": 10 }, 
  "dimensions": { "accountId": 2, "userAgent": "userAgent1" } 
}

Flushing conditions: every 5 minutes, or when number of distinct metrics crosses 1000