deadtrickster / prometheus.erl

Prometheus.io client in Erlang
MIT License
342 stars 117 forks source link

Slow Supervisor Boot Time #81

Open lswith opened 6 years ago

lswith commented 6 years ago

Context: I've added the prometheus_ex library to my phoenix application. When I do this, my mix tasks and overall boot time for the whole application has gone up by a minute. I've started trying to determine where this occurs, and it's definitely happening the moment this application is added to the supervision tree.

Any thoughts on how I can improve runtime boot time?

deadtrickster commented 6 years ago

This might happen because of collectors autodiscovery. To check that you can configure collectors list manually (note default alias) https://github.com/deadtrickster/prometheus.erl#configuration

lswith commented 6 years ago

I love the quick response!

I've actually set the default_collectors to an empty list to test the boot time performance and its still very similar.

lswith commented 6 years ago

So, setting the instrumenters to an empty list as well as the collectors solved the boot time issue. Any ideas what might be the reason for this?

deadtrickster commented 6 years ago

Not sure, what you mean by instrumenters?

lswith commented 6 years ago

you can configure config :prometheus, instrumenters: [].

lswith commented 6 years ago

I think the issue might be in this module: https://github.com/deadtrickster/prometheus.erl/blob/master/src/prometheus_misc.erl

Getting the default instrumenters seems very slow.

lswith commented 6 years ago

I'm just curious what the default instrumenters are? if I wanted to set this configuration to the default, what would it be?

deadtrickster commented 6 years ago

hmm looks like this is a leftover from the past, I was trying to automate instrumenters set up like declaring metrics, but due interactive/embedded mode differences it's not possible to do that reliably. As a temporary fix please add instrumenters: [] to the prometheus config. I'll remove it entirely I think.

dylan-chong commented 2 years ago

Any progress on optimising this? The module_info spam is still causing 9 seconds of startup time for me, a bit annoying for a fast TDD cycle when tests take so long to start