Skip to content

Commit

Permalink
Tolerate newer metrics yaml file
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Nov 9, 2023
1 parent eb8f87d commit 9a235da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Released: not yet

**Enhancements:**

* Tolerated when unknown 'resource' types are specified in the metrics.yaml
file, because one possible reason for that is that a newer metrics.yaml file
is being used. (issue #379)

**Cleanup:**

**Known issues:**
Expand Down
11 changes: 5 additions & 6 deletions zhmc_prometheus_exporter/zhmc_prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,11 @@ def create_metrics_context(session, yaml_metric_groups, hmc_version):
continue # skip this LPAR
resources[metric_group].append(lpar)
else:
new_exc = ImproperExit(
"Invalid 'resource' item in resource metric group {} in "
"metrics file: {}".
format(metric_group, resource_path))
new_exc.__cause__ = None # pylint: disable=invalid-name
raise new_exc
logprint(logging.ERROR, PRINT_ALWAYS,
"Ignoring invalid 'resource' item {rp!r} in resource "
"metric group {mg!r} in metrics file (Is the metrics file "
"newer than the exporter program?)".
format(rp=resource_path, mg=metric_group))

return context, resources

Expand Down

0 comments on commit 9a235da

Please sign in to comment.