ipfs-shipyard / ignite-metrics

Metrics consent and client provider library for ipfs/ipfs-gui team (i.e. IPFS Ignite). See ipfs/ipfs-gui#129 for more details
Other
4 stars 3 forks source link

feat: MetricsProvider should provide interface to accumulate events #61

Closed whizzzkid closed 1 year ago

whizzzkid commented 1 year ago

Countly allows:

Countly.q.push(['add_event',{
  "key": "click",
  "count": 1,
  "sum": 1.5,
  "dur": 30,
  "segmentation": {
    "key1": "value1",
    "key2": "value2"
  }
}]);

a new interface needs to be added:

MetricsProvider.accumulate.event(event: CountlyEvent, flush: boolean)
// event can be indexed by key,
// flush forces a flush to event queue.
accumulatedEvents = Record<key: string, event: CountlyEvent>;

Internally, events can be represented as a hash-map of events by key where:

Optionally, an additional helper method can be provided to force flush the accumulated events synchronously. which can be hooked on the beforunload event.

MetricsProvider.accumulate.flush(key: string)
// this method is called when flush is set to true in `event` call.
// this will be a synchronous call:
Countly.add_event(accumulatedEvents[key])
github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: