Adding two values in Prometheus - performance

We need to add results of two queries in Prometheus. Snippet is below:
(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + (node_time_seconds*1000)
but the result says no data as shown below:

You will get an empty result if the metrics do not match. The reason is that for binary operator vector1 <op> vector2
vector1 and vector2 results in a vector consisting of the elements of
vector1 for which there are elements in vector2 with exactly matching
label sets. Other elements are dropped.
You must at least add a on() or ignoring() vector matching keyword specifying the labels (names) on which the (name and) value match. You may have to add grouping instruction if you have one to many matching.
Fill the ??? in the following expression such that label match:
(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + ON(???) (node_time_seconds*1000)

Related

Prometheus not able to divide 2 values [duplicate]

We need to add results of two queries in Prometheus. Snippet is below:
(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + (node_time_seconds*1000)
but the result says no data as shown below:
You will get an empty result if the metrics do not match. The reason is that for binary operator vector1 <op> vector2
vector1 and vector2 results in a vector consisting of the elements of
vector1 for which there are elements in vector2 with exactly matching
label sets. Other elements are dropped.
You must at least add a on() or ignoring() vector matching keyword specifying the labels (names) on which the (name and) value match. You may have to add grouping instruction if you have one to many matching.
Fill the ??? in the following expression such that label match:
(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + ON(???) (node_time_seconds*1000)

Filtering by Length of Values in Cell using Custom Formula

I have a column D named "body", containing text. I want to filter (show) only values that are greater than 1000 characters, so that rows with small values < 1000 are not shown. How do I address that in the custom formula ?
Use D2 or D:D as your argument to LEN. (This list is non-exhaustive.)
=LEN(D2) >= 1000
=LEN(D:D) >= 1000
I used >= since you said you don't want to show anything less than 1000.

What does this mathcad line mean?

A is a set of real numbers. Really confused as to what this line does. The numerator looks like its taking the subset of A that does not contain the smallest value. The denominator appears to be the range. How can you divide the resulting subset by the range? Or perhaps that is not what the numerator is doing?
A <- (A - min(A)) * (max(A) - min(A))^-1
^-1 means take the matrix inverse not the reciprocal
Assuming A is an matrix of real numbers, then the expression can be broken down as follows:
let mna = min(A) : Scalar - the minimum value of A
let mxa = max(A) : Scalar - the maximum value of A
let N = (A-min(A)) = Array - Scalar - each element of A minus mna
let X = (A-max(A)) ... minus mxa
so we have
N*inverse(X)
... Which would be true if I had put my glasses on and read the expression properly instead of as A <- (A - min(A)) * (A - max(A))^-1
However, as the expression is actually A <- (A - min(A)) * (max(A) - min(A))^-1, the explanation is different.
The expression for N is the same (although I note parenthetically that an expression of the form (array - scalar/conformable-array) means subtract; it is not an array element deletion operation).
However, (max(A) - min(A)) is what it looks like, the maximum value of A minus it's minimum value, and the ^-1 in this instance does mean divide.
The expression therefore returns A with all values scaled to lie between 0 (==min(A)) and 1 (==max(A)).
The <- at the start of the expression is Mathcad's local definition operator (used to assign values in a Mathcad "program") and simply assigns the normalized value of A back to A.

How to get histogram data object from matlab

Lets say I have a matrix x=[ 1 2 1 2 1 2 1 2 3 4 5 ]. To look at its histogram, I can do h=hist(x).
Now, h with retrieve a matrix consisting only the number of occurrences and does not store the original value to which it occurred.
What I want is something like a function which takes a value from x and returns number of occurrences of it. Having said that, what one thing histeq does should we admire is, it automatically scales nearest values according!
How should solve this issue? How exactly people do it?
My reason of interest is in images:
Lets say I have an image. I want to find all number of occurrences of a chrominance value of image.
I'm not really shure what you are looking for, but if you ant to use hist to count the number of occurences, use:
[h,c]=hist(x,sort(unique(x)))
Otherwise hist uses ranges defined by centers. The second output argument returns the corresponding number.
hist has a second return value that will be the bin centers xc corresponding to the counts n returned in form of the first return value: [n, xc] = hist(x). You should have a careful look at the reference which describes a large number of optional arguments that control the behavior of hist. However, hist is way too mighty for your specific problem.
To simply count the number of occurrences of a specific value, you could simply use something like sum(x(:) == 42). The colon operator will linearize your image matrix, the equals operator will yield a list of boolean values with 1 for each element of x that was 42, and thus sum will yield the total number of these occurrences.
An alternative to hist / histc is to use bsxfun:
n = unique(x(:)).'; %'// values contained in x. x can have any number of dims
y = sum(bsxfun(#eq, x(:), n)); %// count for each value

It' possible create a clause that mixes the clauses that it contains?

i have to get a value by developing a list through various clauses, but do not know the best combination between the clauses, because each clause removes items from the initial list and the subsequent works on the remaining list.
Is it possible to create a single clause that you find the best combination of the clauses?
calculate(List,Value):-
calculate_value1(List,R,Value1),
calculate_value1(List,R,Value2),
calculate_value1(List,R,Value3),
max([Value1,Valu2,Value3],Value).
calculate_value1(List,Rest,Value1):-
funcA(List,Rest1,ValueA),
funcB(Rest1,Rest2,ValueB),
funcC(Rest2,Rest3,ValueC).
Value1 is ValueA + ValueB + ValueC.
calculate_value2(List,Rest,Value2):-
funcB(List,Rest1,ValueB),
funcA(Rest1,Rest2,ValueA),
funcC(Rest2,Rest3,ValueC).
Value2 is ValueA + ValueB + ValueC.
calculate_value3(List,Rest,Value3):-
funcC(List,Rest1,ValueC),
funcB(Rest1,Rest2,ValueB),
funcA(Rest2,Rest3,ValueA).
Value3 is ValueA + ValueB + ValueC.
thank you.
I have to compare two lists and I have to be able to find the best balance between them. Then run on lists various clauses that identify if there are identical elements between the first and the second , and then with a ratio of 100 % or if one of a list is the sum of the other second . Also check if they are neighbors who have close relationship , 110 is closer to 100 than to 150 . But the data is not only numeric only .
Now I have several separate clauses : equals ( ) , that identifies the elements equally between the two lists , sum (), which identifies items with a ratio of the sum of them, multiply (), etc. ....
For each clause in the input do I get a list and a list of items that met the criteria of that clause (sum , multiplication, c ....) , with the percentage found and a list of remaining elements that give input to the clause next .
In doing so , however, is a procedural program , because I first calculate the elements the same, then the sum , etc ...
I would like to be able to create a dynamic program that is able to identify the best percentage in any order by clauses .
I hope I was more clear .

Resources