pinterest / elixometer

A light Elixir wrapper around exometer.

Home Page:https://hexdocs.pm/elixometer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get metric value by wildcard key

chvanikoff opened this issue · comments

commented

Let's say we have metrics app.dev.spirals.registered.user.us and app.dev.spirals.registered.user.ca - correct me if I'm wrong, but as of now there's no way to get accumulated value for app.dev.spirals.registered.user._ with Elixometer. It is possible to either introduce a new key like app.dev.spirals.registered.user.total or use :exometer.get_values/1 function, which allows wildcards, directly (:exometer.get_values([:app, :dev, :spirals, :registered, :user, :_]). Both are possible to go with, however I think it would be best to implement call to Exometer.get_values/1 via Elixometer to simplify dealing with keys (which should be list of atoms for Exometer) and results parsing (which is a list of all results found for wildcard).

Hi @chvanikoff, it seems like a good suggestion because elixometer handles prefixing the exometer metric name and uses a single string ("foo.bar.buzz") that is converted to a list in exometer: ["elixometer", "dev", "foo", "bar", "buzz"].

Note that exometer supports a list of atoms, integers, chardatas and/or strings, not just atoms. Elixometer uses a list of strings so you would use: :exometer.get_values(["app", "dev", "spirals", "registered", "user" :_]) to get those values.