TritonDataCenter / node-artedi

a library for measuring fish
2 stars 4 forks source link

could provide a reverse serializer #11

Open KodyKantor opened 6 years ago

KodyKantor commented 6 years ago

It would be nice for some testing suites to be able to send Prometheus text-formatted metrics into node-artedi and get back an object that represents a metric.

For example:

var artedi = require('artedi');

var my_count = artedi.deserialize(artedi.FMT_PROM, 'my_metric{"hello"="world"} 100');
console.log(my_count);
/*
Prints:
{
  name: 'my_metric',
  labels: {
    'hello': 'world'
  },
  value: 100
}
*/

I don't think that we should make any assumptions about the type of the metric (gauge vs counter vs histogram vs something else).

Some questions: