I think I found how to use derivative. Here is what I’ve done:
The way to add Derivative, was to add to the query another metric, that is Derivative. To add the value on which it applies was easy when I started by the value metric: Average [metric name]
In my case (there is an auto complete for the metric name):
Average private_data.systemMetrics.systemData.net.packets_recv
then I got the derivative graph and could hide the value graph.
See the image.
The query looks like this (Lucene):
Query (total received and sent packets queries):
A
Query: $server, Metrics: Average(private_data.systemMetrics.systemData.net.packets_recv), Derivative(), Group by: Date Histogram(private_data.timestamp), Alias: context switch: {{metric}}
B
Query: $server, Metrics: Average(private_data.systemMetrics.systemData.net.packets_sent), Derivative(), Group by: Date Histogram(private_data.timestamp), Alias: context switch {{metric}}
Elasticsearch query:
request:Object
method:“POST”
url:“api/datasources/proxy/1/_msearch”
data:"{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“beaconindex”} {“size”:0,“query”:{“bool”:{“filter”:[{“range”:{“private_data.timestamp”:{“gte”:“1511868117482”,“lte”:“1511871717482”,“format”:“epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,“query”:“lilach\-centos\-vm.com”}}]}},“aggs”:{“2”:{“date_histogram”:{“interval”:“2m”,“field”:“private_data.timestamp”,“min_doc_count”:0,“extended_bounds”:{“min”:“1511868117482”,“max”:“1511871717482”},“format”:“epoch_millis”},“aggs”:{“1”:{“avg”:{“field”:“private_data.systemMetrics.systemData.net.packets_recv”}},“3”:{“derivative”:{“buckets_path”:“1”}}}}}} {“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“beaconindex”} {“size”:0,“query”:{“bool”:{“filter”:[{“range”:{“private_data.timestamp”:{“gte”:“1511868117482”,“lte”:“1511871717482”,“format”:“epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,“query”:“lilach\-centos\-vm.com”}}]}},“aggs”:{“2”:{“date_histogram”:{“interval”:“2m”,“field”:“private_data.timestamp”,“min_doc_count”:0,“extended_bounds”:{“min”:“1511868117482”,“max”:“1511871717482”},“format”:“epoch_millis”},“aggs”:{“1”:{“avg”:{“field”:“private_data.systemMetrics.systemData.net.packets_sent”}},“3”:{“derivative”:{“buckets_path”:“1”}}}}}} "