measurement-protocol icon indicating copy to clipboard operation
measurement-protocol copied to clipboard

Feature: Offline usage / storage

Open mattallty opened this issue 5 years ago • 2 comments

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

mattallty avatar Jun 19 '20 13:06 mattallty

I think we can add a couple of new api supporting this use case:

  • a { timeout } config for send() 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 to toString()

amio avatar Jun 24 '20 11:06 amio

that would be great!

mattallty avatar Jul 06 '20 10:07 mattallty