Implements this function to define how to serialize data. The function must return the metrics object or reject the Promise if the serialization is not possible.
an async string for a text/plain response, an object for a JSON response, or ArrayBuffer for a binary response
IStats is the interface used to implement statistics seralization The serialized object can then be sent to a server for analysis with Telemetry.
Example