Closed hsablonniere closed 1 year ago
source :
Metrics are store as geotime series (GTS) in Warp 10.
A geotime series contains two parts :
class
, labels
class
and labels
are used to access to the data.
RAM available in percent can be fetch using the mem.available_percent
class. Result in percent.
There is many kinds of CPU :
cpu.usage_user
: cpu usage for user space. Results between [0; 1]cpu.usage_system
: cpu usage for system space. Results between [0; 1]
Call the Warp 10 fetch endpoint (https://www.warp10.io/content/03_Documentation/03_Interacting_with_Warp_10/04_Fetching_data/01_Fetching_data)
Example to fetch the last hour of data for an application
curl -vvv -H 'X-Warp10-Token: <READ_TOKEN>' 'https://c1-warp10-clevercloud-customers.services.clever-cloud.com/api/v0/fetch?&now=now×pan=P1H&selector=mem.available_percent\{app_id=app_958b2ff1-XXXX-XXXX-XXXX-XXXXXXXXXXXX\}&format=json'
\
need to be escapes in this example
timespan
follow https://www.wikiwand.com/en/ISO_8601#/Durations
Call the Warp 10 exec endpoint (https://www.warp10.io/content/03_Documentation/03_Interacting_with_Warp_10/09_Analysing_data)
exec a warpscript.
warpscript.mc2
:
'READ_TOKEN' 'data_token' STORE
NOW 'NOW' STORE
{
'token' $data_token
'class' 'mem.available_percent'
'labels' { 'app_id' 'app_958b2ff1-XXXX-XXXX-XXXX-XXXXXXXXXXXX' }
'start' $NOW 1 h -
'end' $NOW
} FETCH
curl -X POST --data @warpscript.mc2 'https://c1-warp10-clevercloud-customers.services.clever-cloud.com/api/v0/exec'
Beware of space in the warpscipt files
The output is a list of GTS looking like as followed
[
{"c":"mem.available_percent","l":{"image_variant":"kibana",".app":"metrics","owner_id":"orga_XXXXXXX-XXX-XXX-XXXXXXXX","datacenter":"par4","source":"telegraf","instance_source":"apps","flavor_name":"S","vm_type":"volatile","zone":"par","hypervisor":"hv-par4-XXXX","host":"XXXX-XXXX-XXXX-bc10-6a5098f7fb6f","deployment_id":"XXXX","app_id":"app_958b2ff1-XXXX-XXXX-XXXX-XXXXXXXXXXXX","image_type":"node"},"a":{},"la":1628513282565,"v":[[1628516642000000,67.809205],[1628516582000000,67.734481],[1628516522000000,67.746737],[1628516462000000,67.748121],[1628516402000000,67.783902],[1628516342000000,67.794774],[1628516282000000,67.821264],....]},
....]
In Clever Cloud, each instance has is owned instance_id
as label.
Hence, we have this ordinal inclusion rules :
Instances ⊆ Applications ⊆ Organisations
In other words, each GTS (dictionary) in the output list should be an instance.
There is a token api in Clever Cloud to get the right token depending of the user
Many things can be done to increase Fetch performance.
As not many points are needed for this component. The data can be sample during the fetch using the sample
parameter :
ex :
curl -vvv -H 'X-Warp10-Token: TOKEN.' 'https://c1-warp10-clevercloud-customers.services.clever-cloud.com/api/v0/fetch?&now=now×pan=P1H&sample=0.01&selector=mem.available_percent\{app_id=app_XXX\}&format=json'
I highly recommand to use the fetch
endpoint
@Galimede Here are some details:
^^ Those are just ideas, I'll let you see what's best.
TODO:
@Galimede Note for later, now that we chose to select "round" hours time windows, the number is not the live one. We need to discuss this.
Feedbacks:
We need to move colors to the theme and reuse tokens
Display
We need a small tile component to display some rough metrics (CPU and RAM).
Details about the chart
Inputs
Outputs
None
Wording / i18n
Data & smart component integration