hubertlepicki

hubertlepicki

Telemetry - calculating custom metrics like RPM (requests per minute) on the host itself

So I have been using Telemetry for a while, but on hosts themselves been mostly doing simple metrics that are counters / last_value, and report to statsd via a simple reporter. Nothing fancy, and the actual aggregation mostly happens outside application.

I have another project, however, where we want to calculate some of these metrics on host itself. The reason being of havin millions events per minute that we do not really care about in any other way than let’s say “give me number of events per minute emitted”. So we don’t want to flood the external system with the irrelevant data and pre-calculate the values on Elixir application, and send aggregate to a reporting dashboard via API call.

I’m not sure if I am doing it right, however. Let’s simplify the use case a bit, let’s say I am interested in a metric of “throughput”, defined as “number of requests served in given minute”.

I am currently using a combination of two metrics to achieve that. First, I have “counter()” that simply increments number of requests served by the application.

Then, I have a custom poller, a GenServer, which wakes up every 60 seconds, stores the current counter value in it’s state, and subtract previous value from current value, and emits “last_value()” type of metric.

This last_value() is my “throughput” that I report to the dashboard using custom reporter.

Is this the right way to do it?

Marked As Solved

hauleth

hauleth

I would say that using just counter should be enough. Then you have methods for calculating the derivative in time in storage. For sure Prometheus, InfluxDB and DataDog have these, so I assume that other backends support something like that as well.

Also Liked

hubertlepicki

hubertlepicki

An yes, right, I can do that in fact. Damn, that’s too simple :sweat_smile:

Thanks!

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31194 112
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement