measurement-protocol
measurement-protocol copied to clipboard
Feature: Offline usage / storage
Hey there,
thanks for this library! I'm planning to use it in a Node.js CLI, but i t would be great to have:
- timeout for requests (it can be long sometimes, the idea is to send a batch in the "beforeExit" event, but I don't want the CLI to be slowed by this)
- related to the first item, a way of storing measurements that have not been sent, for them to be sent on next use.
Storage could be the disk for Node.js usage, and localStorage for browsers. I don't know how Google handles potential duplicates, but I think they do given the nature of HTTP requests.
Would be glad to get your opinion on this
I think we can add a couple of new api supporting this use case:
- a
{ timeout }config forsend()method, maybe a{ onError }too? - a
toString()method for serializing measurement object, so you can store it anywhere, and send it in your ways - a
parse()method maybe? as a companion totoString()
that would be great!