Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:export complex nested values as a metric #266

Merged
merged 9 commits into from
Feb 27, 2024

Conversation

richardtief
Copy link
Member

There are metric keys at the vrops API that return complex data types. In most cases, they contain valuable information that only makes sense when mapped to several dedicated metrics.

Here is an attempt to implement it as generic as possible. If there is a known key with a complex data structure for a collector, then this case must be implemented specifically. Several keys per collector are possible.

Internal vm names are mapped to the name.

Input:

{"rules": [{"class': 'com.integrien.alive.common.affinity.VMStorageAntiAffinityRule', 'name': 'nsxt-controller-anti-affinity', 'type': 'SDRS_VM_ANTI_AFFINITY', 'virtualMachines': ['vm-46814', 'vm-46812', 'vm-46813'], 'valid': True}]}

Output:

vrops_storagepod_config_sdrsconfig_vmstorageantiaffinityrules{
      datacenter="datacenter-1",
      rule_name="nsxt-controller-anti-affinity",
      rule_type="SDRS_VM_ANTI_AFFINITY",
      rules="1/1",
      storagepod="SDRS_MGMT_DDDD",
      valid="true",
      vcenter="vcenter-dddd",
      virtualmachines="['nsx-ctl-1-dddd', 'nsx-ctl-3-dddd', 'nsx-ctl-2-dddd']"
      } 1.0

Copy link
Collaborator

@viennaa viennaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally some real code review again, I like it!

Added some refinements and would like to avoid the use of the internal data structure of GaugeMetricFamily.

richardtief and others added 6 commits February 23, 2024 09:45
Co-authored-by: Tommy Sauer <tommy.sauer@sap.com>
Co-authored-by: Tommy Sauer <tommy.sauer@sap.com>
Co-authored-by: Tommy Sauer <tommy.sauer@sap.com>
Co-authored-by: Tommy Sauer <tommy.sauer@sap.com>
Co-authored-by: Tommy Sauer <tommy.sauer@sap.com>
Copy link
Collaborator

@viennaa viennaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, let's go!

Testing for this is still on the old branch, that's why it is failing.

Copy link

@kevin-fischer kevin-fischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kevin-fischer kevin-fischer removed the request for review from himanip94 February 27, 2024 05:19
@richardtief richardtief merged commit b24acf1 into master Feb 27, 2024
1 check passed
@richardtief richardtief deleted the export-complex-nested-values branch February 27, 2024 09:04
@kevin-fischer
Copy link

Great job on this!
TY for your work, @richardtief and @viennaa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants