Chapter 2. Enabling observability for Red Hat Developer Hub on OpenShift Container Platform
In OpenShift Container Platform, metrics are exposed through an HTTP service endpoint under the /metrics canonical name. You can create a ServiceMonitor custom resource (CR) to scrape metrics from a service endpoint in a user-defined project.
2.1. Enabling metrics monitoring in a Red Hat Developer Hub Operator installation on an OpenShift Container Platform cluster Copy linkLink copied to clipboard!
You can enable and view metrics for an Operator-installed Red Hat Developer Hub instance from the OpenShift Container Platform web console. Metrics are exposed through an HTTP service endpoint under the /metrics canonical name.
By setting the spec.monitoring.enabled field to true in your Red Hat Developer Hub custom resource (CR), you instruct the Operator to automatically create and manage the necessary ServiceMonitor to scrape metrics from the service endpoint.
Prerequisites
- Your OpenShift Container Platform cluster has monitoring for user-defined projects enabled.
- You have installed Red Hat Developer Hub on OpenShift Container Platform using the Red Hat Developer Hub Operator.
-
You have installed the OpenShift CLI (
oc).
Procedure
Use the OpenShift CLI (
oc) to edit your existing Red Hat Developer Hub CR.oc edit Backstage <instance-name>
oc edit Backstage <instance-name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the CR, locate the
specfield and add themonitoringconfiguration block.spec: monitoring: enabled: truespec: monitoring: enabled: trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Save the RHDH CR. The RHDH Operator detects the configuration and automatically creates the corresponding
ServiceMonitorcustom resource (CR).NoteThe Operator automatically configures the
ServiceMonitorwith the correct labels (app.kubernetes.io/instanceandapp.kubernetes.io/name) that match your Backstage CR. TheServiceMonitorwill be namedmetrics-<cr-name>. No additional label configuration is required.
Verification
- From the OpenShift Container Platform web console, select the Observe view.
- Click the Metrics tab to view metrics for Red Hat Developer Hub pods.
-
From the OpenShift Container Platform web console, click Project > Services and verify the labels for
backstage-developer-hub.
2.2. Enabling metrics monitoring in a Helm chart installation on an OpenShift Container Platform cluster Copy linkLink copied to clipboard!
You can enable and view metrics for a Red Hat Developer Hub Helm deployment from the OpenShift Container Platform web console. Metrics monitoring is enabled through configuration during a chart upgrade. After the upgrade, the Helm release generates the necessary ServiceMonitor resource.
Prerequisites
- Your OpenShift Container Platform cluster has monitoring for user-defined projects enabled.
- You have installed Red Hat Developer Hub on OpenShift Container Platform using the Helm chart.
Procedure
- From the OpenShift Container Platform web console, select the Topology view.
Click the overflow menu of the Red Hat Developer Hub Helm chart, and select Upgrade.
On the Upgrade Helm Release page, select the YAML view option in Configure via, then configure the
metricssection in the YAML, as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click Upgrade.
Verification
- From the OpenShift Container Platform web console, select the Observe view.
- Click the Metrics tab to view metrics for Red Hat Developer Hub pods.