Skip to content

Configure Prometheus/metric-storage for observabilityclient on RHOSO 18 - #31

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
omkarjoshi0304:prometheus-metric-storage-config
Sep 22, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
omkarjoshi0304:prometheus-metric-storage-config

Conversation

@omkarjoshi0304

@omkarjoshi0304 omkarjoshi0304 commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

On RHOSO 18 the metric-storage service is not registered in the Keystone catalog, so the observabilityclient bundled with openstack-cli cannot auto-discover Aetos/Prometheus. Its own error ("Failed to configure Prometheus client... can't find prometheus host and port") hides the real cause and gets wrapped into an opaque ToolError.

Add an openstack.prometheus config section (host/port/ca_cert/root_path) that is exported as PROMETHEUS_* environment variables at startup, so the process-pool workers (forked from this process) inherit them. Existing environment values are never overridden, so operator-provided env still wins. Also detect the metric-storage failure signature in command output and raise a clear ToolError naming the missing endpoint and the remedy, instead of the raw Prometheus-client error.

Proof of testing:-Link

@openshift-ci
openshift-ci Bot requested review from lpiwowar and umago September 21, 2026 17:38
On RHOSO 18 the metric-storage service is not registered in the Keystone
catalog, so the observabilityclient bundled with openstack-cli cannot
auto-discover Aetos/Prometheus. Its own error ("Failed to configure
Prometheus client... can't find prometheus host and port") hides the
real cause and gets wrapped into an opaque ToolError.

Add an `openstack.prometheus` config section (host/port/ca_cert/root_path)
that is exported as PROMETHEUS_* environment variables at startup, so the
process-pool workers (forked from this process) inherit them. Existing
environment values are never overridden, so operator-provided env still
wins. Also detect the metric-storage failure signature in command output
and raise a clear ToolError naming the missing endpoint and the remedy,
instead of the raw Prometheus-client error.
@omkarjoshi0304
omkarjoshi0304 force-pushed the prometheus-metric-storage-config branch from 71c94e0 to f776b27 Compare September 21, 2026 17:45

@Akrog Akrog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

Comment thread src/rhos_ls_mcps/osc.py
hides the real cause: the metric-storage (Aetos) endpoint can't be reached.
"""
if (
"Failed to configure Prometheus client" not in stderr

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Personally I think doing a case insensitive check of the word "prometheus" seems safer.

Comment thread src/rhos_ls_mcps/osc.py
"The 'metric-storage' (Aetos/Prometheus) endpoint could not be reached, so "
"metric commands cannot run. On RHOSO 18 it is not registered in the Keystone "
"catalog, so it must be configured explicitly: set the 'openstack.prometheus' "
"section (host/port/ca_cert) in the MCP config, or the PROMETHEUS_HOST / "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Mention that the config is the file config and remove the or from the second option: in the MCP config file, set PROMETHEUS_HOST

Comment thread README.md
- `allow_write`: Whether to allow write operations or not. Default `false`.
- `ca_cert`: CA certificate bundle file location. Default `""`.
- `insecure`: Whether to allow insecure SSL connections or not. Default `false`.
- `prometheus`: Prometheus/Aetos (metric-storage) connection used by `openstack metric ...` commands. Goes under the `openstack.prometheus` key with fields `host`, `port`, `ca_cert`, `root_path`. Required on **RHOSO 18**, where the `metric-storage` service is not registered in the Keystone catalog and cannot be auto-discovered; omit it on **RHOSO 19+**, where the observabilityclient discovers the endpoint from Keystone. The equivalent environment variables `PROMETHEUS_HOST`, `PROMETHEUS_PORT`, `PROMETHEUS_CA_CERT`, `PROMETHEUS_ROOT_PATH` override these values when set (a mounted `/etc/openstack/prometheus.yaml` also works).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Which one takes precedence when all 3 are set?

@openshift-ci

openshift-ci Bot commented Sep 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Akrog, omkarjoshi0304

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 95c9b8f into openstack-k8s-operators:main Sep 22, 2026
3 checks passed
@omkarjoshi0304
omkarjoshi0304 deleted the prometheus-metric-storage-config branch September 23, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants