zowe / zebra

ZEBRA is an open-source incubator project for Zowe. It is a data parsing framework that allows quick and easy access to z/OS performance metrics.
https://zebra.talktothemainframe.com
Eclipse Public License 2.0
22 stars 13 forks source link

Multiple Identifier #112

Open salisbuk7897 opened 1 year ago

salisbuk7897 commented 1 year ago

This pull request contains changes that allow users to specify multiple identifiers in there metrics.json file. it was tested using the following metrics json

{ "RPRT_ALL_UVC": { "lpar": "RPRT", "request": { "report": "CHANNEL", "resource": ",RPRT,MVS_IMAGE" }, "identifiers": [ { "key": "CHACPTVC", "value": "ALL" }, { "key": "CHACPIVC", "value": "ALL" } ], "field": "CHACPUVC", "desc": "Channel" } }

fernandozangari commented 1 year ago

Great news!! this enhanced code is already available to download?

salisbuk7897 commented 1 year ago

@fernandozangari Alex will have to test and merge it before it becomes available on zebra github but if you want to download the enhanced code now, you can download it from my zebra fork at https://github.com/salisbuk7897/zebra.git. Just know that the metrics UI is not completed yet, so you can edit the metrics.json manually to add identifiers

fernandozangari commented 1 year ago

Ok, thanks, no problem, I always use the metrics.json file.

salisbuk7897 commented 1 year ago

Okay cool. You are welcome

fernandozangari commented 1 year ago

Hi Salisu, I tested the multi identifier update with the following metrics.json file, but doesn´t work as expeceted

{ "PC1B_CPCPPNAM_MSU": { "lpar": "PC1B", "request": {"report": "CPC","resource": ",PC1B,MVS_IMAGE"}, "identifiers": [{"key": "CPCPPNAM","value": "ALL"}], "field": "CPCPAMSU", "desc": "Actual consumed MSUs" }, "PC1B_ALL_CH": { "lpar": "PC1B", "request": {"report": "CHANNEL","resource": ",PC1B,MVS_IMAGE"}, "identifiers": [ {"key": "CHACPTVC","value": "ALL"}, {"key": "CHACPIVC","value": "ALL"} ], "field": "CHACPUVC", "desc": "Channel - Part util %" }, "PC1B_ALL_AS2": { "lpar": "PC1B", "request": {"report": "USAGE","resource": ",PC1B,MVS_IMAGE"}, "identifiers": [ {"key": "JUSPJOB","value": "ALL"}, {"key": "JUSPSVCL","value": "ALL"}, {"key": "JUSPCLA","value": "ALL"}, {"key": "JUSPASI","value": "ALL"} ], "field": "JUSPCPUD", "desc": "CPU time for interval (in seconds)" } }

for example, for the Channel metric (PC1B_ALL_CH) I expect one metric name like

PC1B_FC_04_CH

but obtain two metrics

PC1B_FC_CHACPTVC and PC1B_04_CHACPIVC

The same for Address Spaces (PC1B_ALL_AS2)

expected PC1B_RMFGAT_SYSSTC_S_0112_AS2 and obtain (4 metrics)

PC1B_RMFGAT_JUSPJOB PC1B_SYSSTC_JUSPSVCL PC1B_S_JUSPCLA PC1B_0112_JUSPASI

I am sorry that the update doesn´t work as expected. Please tell me if I can help. Thanks

fernandozangari commented 1 year ago

The json output from ZEBRA app/site for job

{"JUSPJOB":"RMFGAT","JUSPASI":"0112","JUSPCLA":"S","JUSPCLAX":"SO","JUSPSVCL":"SYSSTC","JUSPCLP":"1","JUSPDP":"FE","JUSPTAT":"264:24:40","JUSPTRT":"264:24:40","JUSPTCT":"1","JUSPFRT":"22037","JUSPFRXT":"482","JUSPFRXH":"460","JUSPFRXA":"22","JUSPFRXB":"0","JUSPDCTT":"105.8800","JUSPDCTD":"0.014","JUSPEXCR":"0.17","JUSPCPUT":"1418.34","JUSPCPUD":"0.11","JUSPTCBT":"1408.27","JUSPTCBD":"0.11","JUSPQREQ":"0","JUSPQSPR":"0","JUSPQRES":"0.000","JUSPQRSD":"0.0","JUSPQTIM":"0","JUSPQTSD":"0"},

salisbuk7897 commented 1 year ago

@fernandozangari Thanks for testing and reporting the bug. actually it was a mistake from my side, Just like you mentioned, PC1B_FC_04_CH is supposed to be correct output. but I replaced the CH with the Identifier key just to be sure I was getting all identifiers. That's why you got PC1B_FC_CHACPTVC and PC1B_04_CHACPIVC instead of PC1B_FC_CH. I will fix that and we can discuss more if there is need to add the identifier key to the prometheus metrics to allow for easier Identification

fernandozangari commented 1 year ago

@salisbuk7897 Thanks!!, I am checking the results from prometheus and I thought (erroneously probably) that the identifiers would appear in the prometheus metrics. I wait to the resolution and test again. Thank you.

salisbuk7897 commented 1 year ago

@fernandozangari The metric name change has been made. The naming structure is lpar_identifier_desc. You can choose a desc of your choice for each identifier. a sample for the new metrics json structure is as follows:

{ "RPRT_ALL_UVC": { "lpar": "RPRT", "request": { "report": "CHANNEL", "resource": ",RPRT,MVS_IMAGE" }, "identifiers": [ { "key": "CHACPTVC", "value": "ALL", "desc" : "CH" }, { "key": "CHACPIVC", "value": "ALL", "desc" : "CH1" } ], "field": "CHACPUVC", "desc": "Channel" } }

salisbuk7897 commented 1 year ago

@fernandozangari @behives The Metrics user interface is complete. You can test it. There is a readme under user guide (9. create_metrics.md) that explains the new changes and This YouTube video takes us through creating metrics with the interface (https://youtu.be/P69Rnv8F3tU)

fernandozangari commented 1 year ago

thanks @salisbuk7897, I will check it

fernandozangari commented 1 year ago

Hi @salisbuk7897, which is the correct link to the code to test? Thanks

salisbuk7897 commented 1 year ago

@fernandozangari you can get it here https://github.com/salisbuk7897/zebra.git

fernandozangari commented 1 year ago

Hi @salisbuk7897, I checked it, it works and reduces the verbose of metrics.json file, but what I mean (surely I was not clear) is something like this

"LPR1_CH": {"lpar": "LPR1","request": {"report": "CHANNEL","resource": ",LPR1,MVS_IMAGE"}, "identifiers": [ {"field": "CHACPUVC", "id": [{key: "CHACPIVC","value": "ALL"}, {key: "CHACPTVC","value": "ALL"}],
"m_id": "CHLPAR","desc": "Partition utlization percent"}, {"field": "CHACTUVC", "id": [{key: "CHACPIVC","value": "ALL"}, {key: "CHACPTVC","value": "ALL"}],
"m_id": "CHTOT","desc": "Total utilization percent"} ] }

where id is an identifier formed by

CHACPIVC: Channel path ID (may be ALL or discrete) CHACPTVC: Channel path type (may be ALL or discrete)

so the metric ID will be a little different from

{LPAR}_{IDENTIFIERVALUE}{METRIC_ID}

by

{LPAR}_{multikey(separated by "-" or "")}_{METRIC_ID}

LPR1_{CHACPIVC_CHACPTVC}_CHTOT: the benefits of these is that with one metric we have two types of classification and masking; in Grafana we have the possibility of grouping in two or more levels.

For example, in the case of Address Spaces we can add Class of execution and type of AS (Job, STC or TSO).

Hoping that this is possible and not complicate your existence.

fernandozangari commented 1 year ago

Hi @salisbuk7897, a doubt, there is a back compatibility with the old naming convention of metrics.json?

salisbuk7897 commented 1 year ago

@fernandozangari I get it now. The idea is to have multiple identifier names, separated by (LPR1{CHACPIVC_CHACPTVC}_CHTOT), but the field remains the same for both identifier names. This is also possible. I will be able to work on it

fernandozangari commented 1 year ago

Hi @salisbuk7897, YES and THANKS!

salisbuk7897 commented 1 year ago

@fernandozangari sorry I didn't understand this: " back compatibility with the old naming convention of metrics.json". The naming convention within the metrics.json file has changed but the metrics exposed for grafana through /prommetrics are backward compatible. If that didn't answer the question. Please elaborate. Thanks

fernandozangari commented 1 year ago

@salisbuk7897 , OK, I understand. Thanks

salisbuk7897 commented 1 year ago

@fernandozangari Sorry for the long time it took to get back to you on this butI have implemented what we discussed her. you can test the changes from my repo https://github.com/salisbuk7897/zebra/tree/main. This sample metrics.json was used but you can use any metrics of your choice to test { "RPRT_CHANNEL": { "lpar": "RPRT", "multi": true, "request": { "report": "CHANNEL", "resource": ",SYS,MVS_IMAGE" }, "identifiers": [ { "field": "CHACPUVC", "id": [ {"key": "CHACPIVC","value": "ALL"}, {"key": "CHACPTVC","value": "ALL"} ], "m_id": "CHLPAR", "desc": "Partition utlization percent" }, { "field": "CHACTUVC", "id": [ {"key": "CHACPIVC","value": "ALL"}, {"key": "CHACPTVC","value": "ALL"} ], "m_id": "CHTOT", "desc": "Total utilization percent" }, { "field": "CHACMGVC", "id": [ {"key": "CHACPIVC","value": "02"}, {"key": "CHACPTVC","value": "OSD"} ], "m_id": "CHCVG", "desc": "Total utilization percent" } ] } }

fernandozangari commented 1 year ago

Hi Salisu, THANKS! I will test it.

salisbuk7897 commented 1 year ago

The major changes to the metrics.json file is: 1- the multi parameter: this need to be set to true for ZEBRA to treat the metrics as having multiple identifiers

Both instances of the two identifier keys having discrete value or "ALL" as their value has been tested. feel free to let me know if there is a need to add, remove or adjust anything. the multiple metrics now look like this:

image

salisbuk7897 commented 1 year ago

Hi Salisu, THANKS! I will test it.

That was fast. YW.. looking forward to your comments

fernandozangari commented 1 year ago

Hi Salisu, the change works REALLY FINE!, I can now add the name of the SYSPLEX in the LPAR name, ASID in Address Space name and type of channel in the channel name, without implying more metrics but we have more detail classifications, and in consequence more dimensions for the analysis. Really great work!

PD: a doubt, it is limited to two identifiers?