[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-04 Thread Brian Candler
On Saturday, 4 April 2020 10:43:27 UTC+1, Belmark Caday wrote:
>
> Here are the udpdated tests : 
>
>  - series: 'node_filesystem_free{fstype="ext4"}'
>values: '1+0x120'
>
>  - expr: 'predict_linear(node_filesystem_free{fstype!~"tmpfs"}[1h], 4 * 
> 3600) > 0'  
>   
>eval_time: 1m  
> 
> 
>exp_samples:
> 
> 
>  - labels: 'node_filesystem_free{fstype="ext4"}'  
> 
> 
>value: 1  
>
> And here is the error message I get: 
>
>   FAILED:
> expr: "predict_linear(node_filesystem_free{fstype!~\"tmpfs\"}[1h], 4 * 
> 3600) > 0", time: 1m0s,
> exp:"{__name__=\"node_filesystem_free\", fstype=\"ext4\"} 1E+00"
> got:"{fstype=\"ext4\"} 1E+00"
>
>
Good: the error message tells you exactly what the problem is.  You said 
the expected result is

node_filesystem_free{fstype="ext4"} 1

but the actual result was

{fstype="ext4"} 1

That is correct: the output of the predict_linear() function is a 
timeseries with no metric name.

If you go to the prometheus GUI (normally on port 9090) and try these two 
promQL expressions, you'll see the difference:

node_filesystem_free_bytes{fstype!~"tmpfs"}

predict_linear(node_filesystem_free_bytes{fstype!~"tmpfs"}[1h], 4 * 3600)

HTH,

Brian.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/8e31d56a-69ef-4b88-856e-a973937a4b4b%40googlegroups.com.


[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-04 Thread Belmark Caday
Here are the udpdated tests : 

 - series: 'node_filesystem_free{fstype="ext4"}'
   values: '1+0x120'

 - expr: 'predict_linear(node_filesystem_free{fstype!~"tmpfs"}[1h], 4 * 
3600) > 0'  
  
   eval_time: 1m

  
   exp_samples:


 - labels: 'node_filesystem_free{fstype="ext4"}'

  
   value: 1  

And here is the error message I get: 

  FAILED:
expr: "predict_linear(node_filesystem_free{fstype!~\"tmpfs\"}[1h], 4 * 
3600) > 0", time: 1m0s,
exp:"{__name__=\"node_filesystem_free\", fstype=\"ext4\"} 1E+00"
got:"{fstype=\"ext4\"} 1E+00"


On Saturday, April 4, 2020 at 5:05:49 PM UTC+8, Brian Candler wrote:
>
> Put at least two data points in the time series.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/00d879f3-7159-4e7a-9176-6c5df9eab319%40googlegroups.com.


[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-04 Thread Belmark Caday
Here are the test's ive updated : 

Series and values:

[image: Capture1.PNG]

Expr :

[image: Capture2.PNG]

And here is the error message : 

[image: Capture3.PNG]


On Saturday, April 4, 2020 at 5:05:49 PM UTC+8, Brian Candler wrote:
>
> Put at least two data points in the time series.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/3a242d9f-376e-4a61-8a10-c23c59daf4ab%40googlegroups.com.


[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-04 Thread Brian Candler
Put at least two data points in the time series.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4e32d016-a385-4c15-80d4-0afe4346a138%40googlegroups.com.


[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-03 Thread Belmark Caday


On Friday, April 3, 2020 at 3:02:45 PM UTC+8, Brian Candler wrote:
>
> Expression 1 uses a range vector (data over a 1 hour time window) with 
> predict_linear.  However if you only provide one data point, then there's 
> no way it can do linear regression to fit a line.
>
 

   I already changed the time window to 1m, still it fails the test. 
can you give me example how to test it? 

> Expression 2 performs an operation between two different metrics, but 
> you've only provided a data point for one metric.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/bfc03165-997f-440b-8e4d-7af4c5effae0%40googlegroups.com.


[prometheus-users] Re: Writing prometheus test with metric operations/function

2020-04-03 Thread Brian Candler
Expression 1 uses a range vector (data over a 1 hour time window) with 
predict_linear.  However if you only provide one data point, then there's 
no way it can do linear regression to fit a line.

Expression 2 performs an operation between two different metrics, but 
you've only provided a data point for one metric.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/3871be2a-99df-4550-afe2-a75b76db83c0%40googlegroups.com.