Hi all!

Some time ago Guenter_Grossberger asked me to help out on a PoC he was at. The customer wanted to see that we can report/monitor metric percentiles.

Percentiles are values most of us are familiar with I guess. In CEM for example, percentiles are calculated on the response times of a business transaction. For those of you not yet familiar with it, a quick web search give you what you're looking for

There are actually a couple of different ways to calculate a percentile, and you'll even find scientific documents about it. To keep things simple, I used an algorithm for dummies, and this is what it says:

To calculate the *k*^{th} percentile (where *k* is any number between zero and one hundred), do the following steps:

**Order all the values in the data set from smallest to largest.****Multiply***k*percent by the total number of values,*n*. This number is called the index.**If the index obtained in Step 2 is not a whole number, round it up to the nearest whole number and go to Step 4a.****If the index obtained in Step 2 is a whole number, go to Step 4b.****a) Count the values in your data set from left to right (from the smallest to the largest value) until you reach the number indicated by Step 3. The corresponding value in your data set is the***k*^{th}percentile.**b) Count the values in your data set from left to right until you reach the number indicated by Step 2. The***k*^{th}percentile is the average of that corresponding value in your data set and the value that directly follows it.

So, it is actually not that hard. With a JS calculator we can persist the values we get every 15 seconds. And then we calculate/find the percentile on this set of persisted values every *n* minutes.

The JS calculator "keeps" this value (to keep the agent from "graying out"), until it's time to calculate the value again. Also important - the set of persisted metrics are cleared after every calculation to prevent some kind of memory leak.

I've attached a zip, with different "versions" of the calculator (5 min interval, 10 min interval, etc.) as well as a management module to test the calculator (works with our standard demo). There is a short README at the beginning of the file, and the variables you might want to change are marked *** CHANGE ***. It shouldn't be to hard to get it.

Feel free to reach out to me with any question, and of course to use and modify the calculator. And remember to always keep an eye on the performance of your EM when running a lot of JS calculators I've only tested it locally, in a demo environment, so be careful at first. As Guenter would say: TEST, TEST and then do some TESTING

BR,

Stig

Hi Stig,

A nice addition, but one has to be extremely careful how to interpret this value.

Let me explain. From what I gather you are basing your percentile calculation on the averages Introscope collects every interval. This means that the calculator creates percentiles based on averages and not percentiles based on the real executions of the method.

Interlude: Stefan does not like mean valuesI have to say that I dislike averages (to be more correct, mean values) quite a bit. They often do not represent the data set in an human-understandable fashion. Have a look at the small example at Neuroscience for Kids - Statistics. They set up an example where they have a data set of how much money kids bring to school (2, 3, 1, 10, 5, 2, 999). Actually a data set like this could very easily be response times of a frontend. Calculating the mean of this data set will yield 146. Just seeing the mean of 146, next to no-one I ever met doing application monitoring would think of a possible distribution like this one.

Usually this is why I highly prefer percentiles. They can easily be understand by everyone. I usually go an say "look this (or better) is the response time that 99 (for the 99th percentile) of your customer experience".

Calculating the percentile from raw data is a tremendous value. Calculating them based on means does not help too much - I'm afraid. As this does not remove the problem that means are not intuitive. Based on this metric we

cannotsay that this is the response time that n% of your customers see!Cheers,

Stefan

PS: Stig, long time no see. Hope we see each other soon again