Frage

I'm trying out Folsom for metrics generation in Erlang.

I've created a histogram (slide), how can I get the values out of it? I'm using

(test@SebMaynardSL2)1> folsom:start().
(test@SebMaynardSL2)2> MyMetric = "mymetric",
(test@SebMaynardSL2)3> folsom_metrics:new_histogram(MyMetric, slide). 

And tried putting some values in it:

(test@SebMaynardSL2)4> [ folsom_metrics:notify({MyMetric, V}) || V <- lists:seq(1, 10) ].

But getting the values out (with folsom_metrics:get_metric_value/1) seems to be return the results in rather a strange order:

(test@SebMaynardSL2)5> folsom_metrics:get_metric_value(MyMetric).
[4,5,8,9,3,10,2,7,6,1]

If I wait a while (60 seconds, the default slide window time) and do it again, I don't necessarily end up with a metric value in the same order.

How should I get the values out of Folsom to use for (say) graph generation? I did consider putting {now(), V} instead of just V in my notify, and then sorting the returned result set by the first tuple value, but it seems odd that the results are coming back (or rather, are getting written) in a weird order, and Folsom is keeping track of the time of events anyway (to make it "slide").

This is using Folsom 0.7.4, with Erlang R16B

Thanks!

War es hilfreich?

Lösung

Rather oddly, after a fresh clone and checking out tag 0.7.4 again, running the commands from the question gives the results in the correct order:

(test@SebMaynardSL2)5> folsom_metrics:get_metric_value(MyMetric).
[1,2,3,4,5,6,7,8,9,10]

Perhaps this wasn't an issue after all. No idea why it was generating such oddities the other day.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top