Tracking success and errors

While building a side application, a thought came to mind in regards to gaining information on my users. For example, how many successfully applied, how many errors or even log the error to better understand where it’s breaking.

In my company we are using Kibana that tells us all the logging errors or specific ones we have created which helps us learn a lot.

My question is in regards to Phoenix, would it be recommended to use Kibana as well? or create my own logging table where I log any problems that may occur and create a page which shows me all the errors being logged or even success (if I wanted to track how many users applied etc for example).

Would love to hear what approach people took when such a problem came for your own personal project.

Hello Yama!

I understand that you have questions regarding if it is a good idea to save the errors somewhere for further analysis.

If it is pure metrics you want, I suggest you have a look at PrometheusEx. It will give you memory, cpu and it will allow you to define metrics on your own as well. You can then use the Prometheus UI,or if you want you want use Kibana to check the /metircs endpoint that PrometheusEx exposes and do something with it (I don’t have a lot of experience with Kibana, but since we use Graphana this way I assume it is also possible).

Another cool idea, if you use hackney, is to hookup with its metrics module (https://github.com/benoitc/hackney#metrics). This is more messy, but it also offers you some intel.

If you want to save general errors (regardless of the protocol you use) then using an ETS table is not a bad idea. We use ETS tables a lot at my place and we save errors in them for posterior analysis as well. There is one catch though: be sure to empty your tables from time to time, or else your machine will run out of memory and crash.

If you have a setback for this (we have 2 mechanisms to avoid this ever happens) then you should be good to go!

Hope it helps!

1 Like