Thanks to visit codestin.com
Credit goes to github.com

Skip to content

could provide a reverse serializer #11

@KodyKantor

Description

@KodyKantor

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:

  • Should we allow the user to pass in an array of metrics to deserialize?
  • Should the output of the deserialize function be able to be passed directly into another collector function? (e.g. counter.add(artedi.deserialize(FMT_PROM, my_string_metric)) ). If so, we could probably assert that the collector names are the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions