I'm using Graphite with Codahale to record metrics from my java server. I have a block code that looks something like that:
public void foo() {
try (Timer.Context ignored = myTimer.start()) {
// Some code
}
}
When I look at today's event count (each timer is also a counter) I see that we're around the hundred of hit counts a minute, which means a a few thousands an hour. When I widen the date range to include yesterday as well, I see that the results are in the millions range and I could not figure out why.
The results are shown after nonNegativeDerivative operation on the metric
Today's results:
With yesterday's results:
If using nonNegativeDerivative() - please apply derivative first, and then sumSeries() - not vise versa. Please check http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/
Also, you need to set up correct aggregation (sum) for counters like described in http://obfuscurity.com/2012/05/A-Precautionary-Tale-for-Graphite-Users
you do not want to use sum on dropwizard counters. You want to use "last" they are incrementing decrementing gauges. You also want perSecond() and hitcount(10s) instead of the derivative.
http://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.perSecond
Related
I have been struggling for a few days with this problem. Anyone kind enough to show some interested will be highly appreciated.
I have the table shown below.
Suppose columns represent months. I would like to know up to which months' orders have been used up.
I have tried criteria with sums of demand up to that point but I cannot seem to use criteria with the sum of total demand and an array of sums of "total units ordered".
F.e. =COUNTIF(SUM($S$2:($S$2:S$2))<SUM($S$1:S$1) is not possible.
I have tried using an index-match combo but i would have to deduct the previous max sum of "total units ordered" that meets the condition up to the previous cell.
Is that possible without using vba?
Thanks in advance for your interest and time spent.
You can use a standard method of getting running totals using Sumif, combined with Match:
=ArrayFormula(match(sumif(column(S1:Z1),"<="&column(S1:Z1),S1:Z1),sumif(column(S2:Z2),"<"&column(S2:Z2),S2:Z2))-1)
I put rows 3 and 4 in just as a check of my calculations and to show the results of the two Sumifs evaluations - they aren't necessary.
You may wish to specify what should happen if the demands add up to exactly 3000, for example. The above formula would actually go to the next month, so may need some refinement if that is not what you want.
I have a Prometheus metric called device_number. What I want is to show the difference in value between now and one day/week/month etc ago. Which means subtracting two values with two different timestamps.
Checking around I don't find any useful documentation on how to do it.
Something I would do, but doesn't work is:
sum(device_number) - sum(device_number[$__range])
I found offset is the correct keyword.
Query like this:
sum(vss_device_number) - sum(vss_device_number offset 1d)
Will return difference between now and yesterday.
Docs.
PromQL also provides delta() function, which can be used for returning the delta between the current time and the time specified in square brackets passed to this function. For example, the following query should return the delta for vss_device_number over the last day (see [1d]):
delta(vss_device_number[1d])
The query returns deltas per each matching time series. If you need summary delta across all the matching time series, then wrap the query into sum():
sum(delta(vss_device_number[1d]))
I have the following function
=IF(RAND()<0.25,1,0)
RAND() returns any value between 0 to 1 in decimal format and the idea is that an item has a 25% chance of getting a 1. If it was less than 0.25 the rand() then its a hit and gets a 1 otherwise a 0. Now lets say I need to do this 100 times and add up the sum of all the '1's that were created, which in this case will average to around 25 for 25%. How do I do this in Google Spreadsheets?
Basically looking for a way to repeat a function n'th amount of times and sum the results.
I have looked around everywhere (youtube, google forums) and have not found any solutions.
I may as well put this as an answer because it tries to address the broader question of whether you can repeat a function (say) 100 times. The answer is, yes if the function is compatible with an array formula. Rand can't be used in this way because it doesn't take any arguments (neither do some other functions like countifs for some reason). But you could get round it by using Randbetween instead and providing it with 100 array elements. These are multiplied by zero so don't actually affect the answer, but Google Sheets still evaluates the function 100 times:
ArrayFormula(sum(if(randbetween(0,A1:A100*0+99)<25,1,0)))
or
=Sumproduct(if(randbetween(0,A1:A100*0+99)<25,1,0))
The result is each time you force this to re-calculate (by changing something in the range A1:A100 or by setting File -> Spreadsheet Settings -> (Tab) Calculation -> Recalculation to every minute) it will give an answer around 25.
To make it more resilient (allow any value in A1:A100 including error values) could try
=ArrayFormula(sum(if(randbetween(0,iferror(A1:A100/0,0)+99)<25,1,0)))
or
=Sumproduct(if(randbetween(0,iferror(A1:A100/0,0)+99)<25,1,0))
I don't know why I didn't do this in the first place
=ArrayFormula(sum(if(randbetween(0,row(A1:A100)*0+99)<25,1,0)))
then this easily allows for a variable range
=ArrayFormula(sum(if(randbetween(0,row(indirect("A1:A"&H1))*0+99)<25,1,0)))
where the number in H1 doesn't have to be limited to the number of rows in the sheet.
Okay so I found a very convoluted answer. If someone finds a better please let me know.
The first thing as the user |'-'| commented was to create a range on separate sheet.
Since I know that I will not be looking up more than 200 values at once I created my range to be 200 long of this formula.
=IF(RAND()<0.25,1,0)
This will create the initial list of random values.
The next step is you need to generate a randomizer seed. Which is basically a random number between the range you created. You can do this with
=RANDBETWEEN(1,200)
This should be on the same column as what you are trying to sum up later.
Next you want to create a dynamic string that you can access via arrayFormula later.
="Randomizer!B"&B12&":B"&B12+B3
In my case I had the 200 random numbers on a sheet called randomizer. Notice the &, this is how you connect strings. In my example B12 is the reference to the =RANDBETWEEN(1,200), and B3 is how many times I want the randomness to occur. It can be any value as long as it's less than the randomizer seed by the amount of times you want it to be random.
Finally refer to this string using, =SUM(ARRAYFORMULA(INDIRECT(B13))) , indirect lets you refer to a string as a cell and this is how I was able to create a dynamic range to calculate from.
I will say the advantage of this method is its super fast to calculate since the random numbers have been pre-computed.
The idea is that it will keep creating random ranges from the precomputed random numbers you created, and then summing those ranges, essentially calculating random numbers n'th amount of times.
Hope this helps someone.
I'm having some trouble getting these functions to work. I'm not even sure if they're the ones that I should be using, but here is the following information I can provide. I had previously opened a topic, but I was getting responses about my confusing query. So, hopefully this one is better explained.
I have data in the following fields: A1:N7, as well as A12:L18.
I need a function to check all of the fields and add up the amount of times certain numbers show up. The numbers that need to be checked are: <90, 90-99.99, 100-109.99, and =>100.
First off, I can use this formula to count the <90 and =>100 values in all the fields, which works.
=COUNTIFS(A1:N7,"<90")
However, I'm unsure how to appropriately add the results from A12:L18 into it. My attempts have failed. Likewise, for the ranged functions, I'm completely lost. I've tried something like this:
=COUNT(FILTER(A1:N7,A1:N7>=90,A1:N7<=99.99))
Yet, this always returns 0 as the result. In addition, like the above formula I don't know how I'd nest in a way to check the additional fields in A12:L18.
An old thread, but I came across it trying to solve a similar problem.
Using the original example:
=COUNT(FILTER(A1:N7,A1:N7>=90,A1:N7<=99.99))
I was also getting zero until I realised COUNT returns the number of NUMERIC values in the range. Assuming the result range isn't numeric, I tried:
=COUNTA(FILTER(A1:N7,A1:N7>=90,A1:N7<=99.99))
and got the result I was expecting.
You just need count rows your matrix with ROWS()
=ROWS(FILTER(...))
Does this formula work as you want:
={"<90",COUNTIF({A1:N7;A12:N18},"<90");"90-99.99",COUNTIFS({A1:N7;A12:N18},">=90",{A1:N7;A12:N18},"<100");"100-109.99",COUNTIFS({A1:N7;A12:N18},">=100",{A1:N7;A12:N18},"<110");"=>110",COUNTIF({A1:N7;A12:N18},">=110")}
I made an example sheet where you can see it working: https://docs.google.com/spreadsheets/d/1BPexh5syksapZ9rd_brAa3NkN28LXAvB6dVMLEkM2r0/edit#gid=0
I have two write points for InfluxDB, one is the start and the other is the end. I just need to determine the duration between those two events, and make queries around it. InfluxDB has difference() aggregate method, but it doesn't work on the time meta field.
Is supplying a custom timestamp value the only way to accomplish this?
As per "Can I perform mathematical operations against timestamps?"
No:
"Currently, it is not possible to execute mathematical operators against timestamp values in InfluxDB. Most time calculations must be carried out by the client receiving the query results."
and yes, maybe:
The function ELAPSED() returns the difference between subsequent timestamps in a single field.
So it depends on the shape of your data.
If you write only the mentioned two entries then you can follow the below steps -
Limit the result to two (Eg: select * from timeseries limit 2)
Extract the time from the result set
Take the difference between the time