boundary / folsom

Expose Erlang Events and Metrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grouped metrics

pmembrey opened this issue · comments

Hi,

I'm not sure if I've just missed how to do this, but is it possible to group metrics together? For example, say I have 10 TCP connections that are sending and receiving messages. I'm currently capturing the number of messages a second with folsom and it's working perfectly.

If I want to make this available to say a web browser for viewing, it would be useful to be able to retrieve those metrics as a group. For example if I have a page like:

/metrics/tcp/

It would be great to be able to easily pull back all the TCP statistics to display on that page. Right now I guess the best way is to simply name them appropriately, but being able to add them to groups (ideally multiple groups) would be really awesome.

Another area where this would be useful is if there are a set of different metrics for the same logical entity. Then on the page I can request everything in that entity's group and easily get all the metrics I'd need need to display it.

If it's not currently doable, I'd be interested in offering a bounty to someone who could add such a feature and get it accepted to core :)

Cheers,

Pete

not sure if this is exactly what you need, but you can use any term that is legal as a key for ETS as a name for a metric.

this way {tcp, a}, {tcp, b}, {tcp, c} could be good names for your use case as that should be pretty straightforward for filtering out the relevant ones, achieving a grouping effect.

best regards,
Fabian

Myself and others have considered introducing metric namespaces to folsom but haven't written any code to do so.

I think the easiest and least invasive change would be to flesh out a better query interface so you can tag (https://github.com/boundary/folsom/blob/master/src/folsom_ets.erl#L46) and query metrics based off the tags assigned. Ideally you would be able to get all metrics with a certain tag returned to you as well as rolled up statistics of a tag query (histogram of N histograms, average rate of N rate metrics, etc).

I am happy to help review patches and guide development of this but currently don't have the time to bite off a bigger project like this.

Thoughts?

That sounds ideal, but I don't really have the time to work on it either....

I am willing to put my money where my mouth is though. If anybody would be interested in doing this for a bounty, I'd be happy to sponsor it...

Cool, tweeted about it (https://twitter.com/williamsjoe/status/292137987209302016) we'll see if we get any takers and can outline what the criteria are then.

I use tuples as Hierarchical name spaces. I have a module for querying these hierarchies in basho's riak-core repo. It needs more features, but right now it takes a list of atoms as a path and will return all stats that have a name on that path. You can pass in the underscore atom as a wild card too.

I've done some work on rolling up stats with a common lineage into aggregates, but it's naive, specific, and incompltete. Happy to work with othersto move this code out of riak and into folsom.

Hi everyone!

I took some time to get acquainted with Folsom's codebase and how this feature request could be implemented, as well as taking a glimpse at how metrics are being handled in riak-core as suggested by @russelldb.

Some things are not entirely clear to me regarding the grouped metrics feature:

(i) Metrics of different type (e.g. counter and histogram) could belong to the same group (i.e. share the same tag) right?

(ii) Is the goal to provide the user with the values of the different metrics with a common tag in a list (or other container), or the goal is return a single aggregate of the metrics with a common tag (as @joewilliams puts it, "histogram of N histograms, average rate of N rate metrics, etc")?

(iii) If we are speaking of aggregation, is it even possible to aggregate metrics of different types? Or the user specify what type of grouped metrics he wants (e.g. folsom_metrics:get_group_value("some_tag", counter))?

(iv) For some types, aggregation is natural (sum for counters, avg. rate for meters, merge for histories), but for other types things are not as straightforward. Can you aggregate two gauges? Two histograms with different samples?

I'm not acquainted with metrics systems, so feel comfortable to tell me if my questions make no sense. Thanks!

The first PR came in, please review guys! #51