Skip to content

Commit d459fbc

Browse files
[release-1.8] RHIDP-8637: OpenTelemetry Service Monitor (#1468)
* OpenTelemetry Service Monitor * Incorporated Fortune's updates * Incorporated Fortune's comments * Minor typo fixes * Incorporated Jana's comments * Minor change --------- Co-authored-by: Priyanka Abel <[email protected]>
1 parent f4d6479 commit d459fbc

File tree

2 files changed

+20
-42
lines changed

2 files changed

+20
-42
lines changed

modules/observe/proc-admin-enabling-metrics-ocp-helm.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[id="proc-admin-enabling-metrics-ocp-helm_{context}"]
44
= Enabling metrics monitoring in a Helm chart installation on an {ocp-short} cluster
55

6-
You can enable and view metrics for a {product} Helm deployment from the *Developer* perspective of the {ocp-short} web console.
6+
You can enable and view metrics for a {product} Helm deployment from the {ocp-short} web console. Metrics monitoring is enabled through configuration during a chart upgrade. After the upgrade, the Helm release generates the necessary `ServiceMonitor` resource.
77

88
.Prerequisites
99

@@ -12,7 +12,7 @@ You can enable and view metrics for a {product} Helm deployment from the *Develo
1212

1313
.Procedure
1414

15-
. From the *Developer* perspective in the {ocp-short} web console, select the *Topology* view.
15+
. From the {ocp-short} web console, select the *Topology* view.
1616
. Click the overflow menu of the {product} Helm chart, and select *Upgrade*.
1717
+
1818
image::rhdh/helm-upgrade.png[]
@@ -37,5 +37,5 @@ image::rhdh/upgrade-helm-metrics.png[]
3737

3838
.Verification
3939

40-
. From the *Developer* perspective in the {ocp-short} web console, select the *Observe* view.
40+
. From the {ocp-short} web console, select the *Observe* view.
4141
. Click the *Metrics* tab to view metrics for {product} pods.

modules/observe/proc-admin-enabling-metrics-ocp-operator.adoc

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
[id="proc-admin-enabling-metrics-ocp-operator_{context}"]
44
= Enabling metrics monitoring in a {product} Operator installation on an {ocp-short} cluster
55

6-
You can enable and view metrics for an Operator-installed {product} instance from the *Developer* perspective of the {ocp-short} web console.
6+
You can enable and view metrics for an Operator-installed {product} instance from the {ocp-short} web console. Metrics are exposed through an HTTP service endpoint under the `/metrics` canonical name.
7+
8+
By setting the `spec.monitoring.enabled` field to `true` in your {product} custom resource (CR), you instruct the Operator to automatically create and manage the necessary `ServiceMonitor` to scrape metrics from the service endpoint.
79

810
.Prerequisites
911

@@ -13,53 +15,29 @@ You can enable and view metrics for an Operator-installed {product} instance fro
1315

1416
.Procedure
1517

16-
Currently, the {product} Operator does not support creating a `ServiceMonitor` custom resource (CR) by default. You must complete the following steps to create a `ServiceMonitor` CR to scrape metrics from the endpoint.
17-
18-
. Create the `ServiceMonitor` CR as a YAML file:
18+
. Use the *OpenShift CLI* (`oc`) to edit your existing {product} CR.
19+
+
20+
[source,bash]
21+
----
22+
oc edit Backstage <instance-name>
23+
----
24+
. In the CR, locate the `spec` field and add the `monitoring` configuration block.
1925
+
20-
[source,yaml,subs="+attributes,+quotes"]
26+
[source,yaml]
2127
----
22-
apiVersion: monitoring.coreos.com/v1
23-
kind: ServiceMonitor
24-
metadata:
25-
name: _<developer_hub_service_monitor_name>_ <1>
26-
namespace: _<rhdh_namespace_name>_ <2>
27-
labels:
28-
app.kubernetes.io/instance: _<rhdh_cr_name>_ <3>
29-
app.kubernetes.io/name: {product-custom-resource-type}
3028
spec:
31-
namespaceSelector:
32-
matchNames:
33-
- _<rhdh_namespace_name>_ <4>
34-
selector:
35-
matchLabels:
36-
app.kubernetes.io/instance: _<deployment_name>_ <5>
37-
app.kubernetes.io/name: _<rhdh_cr_type>_ <6>
38-
endpoints:
39-
- port: http-metrics
40-
path: '/metrics'
29+
monitoring:
30+
enabled: true
4131
----
42-
<1> The name of your `ServiceMonitor` resource, for example, `developer_hub_service_monitor`.
43-
<2> The namespace where your `ServiceMonitor` will live, for example, `{my-product-namespace}`.
44-
<3> The label name identifying the `ServiceMonitor` CR instance, for example, `{my-product-cr-name}`.
45-
<4> The namespace where your {product-very-short} instance is installed, for example, `{my-product-namespace}`.
46-
<5> The name of your {product-very-short} deployment, for example, `developer-hub`.
47-
<6> The name of your {product-very-short} application, for example, `backstage`.
32+
. Save the {product-very-short} CR. The {product-very-short} Operator detects the configuration and automatically creates the corresponding `ServiceMonitor` custom resource (CR).
4833
+
4934
[NOTE]
5035
====
51-
`spec.selector.matchLabels` configuration must match the labels of your {product-very-short} installation.
36+
The Operator automatically configures the `ServiceMonitor` with the correct labels (`app.kubernetes.io/instance` and `app.kubernetes.io/name`) that match your Backstage CR. The `ServiceMonitor` will be named `metrics-<cr-name>`. No additional label configuration is required.
5237
====
5338

54-
. Apply the `ServiceMonitor` CR by running the following command:
55-
+
56-
[source,terminal]
57-
----
58-
oc apply -f <filename>
59-
----
60-
6139
.Verification
6240

63-
. From the *Developer* perspective in the {ocp-short} web console, select the *Observe* view.
41+
. From the {ocp-short} web console, select the *Observe* view.
6442
. Click the *Metrics* tab to view metrics for {product} pods.
65-
. From the Developer perspective in the {ocp-short} web console, click **Project > Services** and verify the labels for `backstage-developer-hub`.
43+
. From the {ocp-short} web console, click **Project > Services** and verify the labels for `backstage-developer-hub`.

0 commit comments

Comments
 (0)