...
The data will be stored with RP
one_month
and namemgmt_api_requests
It will have the following values:
count_requests
: The number of requests made during 5 minutes. This is needed in our example.sum_request_duration
: A sum of the duration of request processing during 5 minutes. This can be used to display which requests are slowest to process and might be the causes of performance problems.mean_request_duration
: The mean duration of request processing during 5 minutes. This can be used to display how long requests take on average.Tags
path
,method
,api_client_id
andoauth2_client_id
. Of thesepath
is needed for our example, others can be used in other graphs.
The fields
response_code
,request_uri
apparently cannot be used for grouping in a CQ, so they are not included.
Test the Continuous Query
Make a few Management API calls to add data.
Code Block |
---|
curl -X GET "https://your-id-server.com/api/rest/v1/version" |
Wait 5 minutes for the CQ to run. Then run the query:
Code Block | ||||
---|---|---|---|---|
| ||||
> SELECT * FROM one_month.mgmt_api_requests
name: mgmt_api_requests
time api_client_id count_requests mean_request_duration method path sum_request_duration
---- ------------- -------------- --------------------- ------ ---- --------------------
1608640500000000000 1248769513590337 1 14 GET user/{userId}/customfields 14
1608640500000000000 1248769513590337 2 48.5 POST user/{userId}/customfields 97
1608640500000000000 5 2 GET example 10
1608641100000000000 6 1.8333333333333333 GET version 11
|
We see that 6 such requests were made, with an average processing time of 1.83 ms.
Update the Grafana panel
Make a duplicate of the original panel as a backup. Update the panel query configuration:
In FROM use the
one_month
RP and themgmt_api_requests
name,change the SELECT parameters to use field
count_requests
and the function tosum()
since we now need to add the counts up.
...
The graph now shows the expected correct values. You should change the Min interval to 5m
to match the CQ, and to visualise that the data covers a 5 minute period.
...