prometheus.erl icon indicating copy to clipboard operation
prometheus.erl copied to clipboard

Support for erlang:system_info(ets_count)

Open jchristgit opened this issue 6 years ago • 2 comments

Hello, thanks for making this library! I've built something similar based on Munin recently but why reinvent the wheel 😄

In the ETS/DETS graph collected via prometheus_vm_system_info_collector I saw that the library currently only collects the limit of ETS tables. OTP 21.1+ has added support for also displaying the total amount of ETS tables in the runtime, which I think would be very useful to also display there. From the README I can see that OTP 18+ is supported - is there perhaps a way to display this on higher OTP releases without breaking backwards compatibility?

jchristgit avatar May 27 '19 17:05 jchristgit

Hi, maybe with platform_define. Want to give it a try?

deadtrickster avatar May 29 '19 05:05 deadtrickster

Hi @deadtrickster, thanks for the recommendation with using platform_define.

I've set up some code locally that accomplishes adding this metric to the result on newer OTP versions but I currently see two issues with it:

  • Since -ifdef and friends cannot be used within a function, this results in a lot of code duplication (unless we add an extra function appending metrics, e.g. platform_specific_metrics/0), especially in tests
  • When compiling this via Elixir (using mix the Macro does not seem to be defined, when running via rebar3 in this project it seems to work just fine. I haven't used rebar3 before, so maybe I'm just forgetting something here.

However, I've found that these metrics are already exported via the vm_memory collector:

# TYPE erlang_vm_memory_dets_tables gauge
# HELP erlang_vm_memory_dets_tables Erlang VM DETS Tables count.
erlang_vm_memory_dets_tables 0
# TYPE erlang_vm_memory_ets_tables gauge
# HELP erlang_vm_memory_ets_tables Erlang VM ETS Tables count.
erlang_vm_memory_ets_tables 104

so this might be an issue with the Grafana dashboard instead, or maybe a misconfiguration on my part? Since the screenshot on the README shows it, I believe it might be a misconfiguration issue for me locally - but since it's like a two-line change I've opened a pull request regardless in case I'm wrong 😄

Either way, figuring out how to cleanly make use of the feature flags would be great - that way graphs such as for the scheduler module could also be added without a big hassle. I can open up a draft PR for what I have so far either way if you want to take a look.

jchristgit avatar May 30 '19 13:05 jchristgit