Chapter 6. Monitoring the Dev Workspace operator
This chapter describes how to configure an example monitoring stack to process metrics exposed by the Dev Workspace operator. You must enable the Dev Workspace operator to follow the instructions in this chapter. See https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.14/html-single/installation_guide/index#enabling-dev-workspace-operator.adoc.
6.1. Collecting Dev Workspace operator metrics with Prometheus Copy linkLink copied to clipboard!
This section describes how to use the Prometheus to collect, store, and query metrics about the Dev Workspace operator.
Prerequisites
-
The
devworkspace-controller-metricsservice is exposing metrics on port8443. -
The
devworkspace-webhookserverservice is exposing metrics on port9443. By default, the service exposes metrics on port9443. -
Prometheus 2.26.0 or later is running. The Prometheus console is running on port
9090with a corresponding service and route. See First steps with Prometheus.
Procedure
Create a
ClusterRoleBindingto bind theServiceAccountassociated with Prometheus to the devworkspace-controller-metrics-readerClusterRole. Without theClusterRoleBinding, you cannot access Dev Workspace metrics because they are protected with role-based access control (RBAC).Example 6.1. ClusterRole example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 6.2. ClusterRoleBinding example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Prometheus to scrape metrics from the
8443port exposed by thedevworkspace-controller-metricsservice, and9443port exposed by thedevworkspace-webhookserverservice.Example 6.3. Prometheus configuration example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- 1
- Rate at which a target is scraped.
- 2
- Rate at which recording and alerting rules are re-checked.
- 3
- Resources that Prometheus monitors. In the default configuration, two jobs (
DevWorkspaceandDevWorkspace webhooks), scrape the time series data exposed by thedevworkspace-controller-metricsanddevworkspace-webhookserverservices. - 4
- Scrape metrics from the
8443port. - 5
- Scrape metrics from the
9443port.
Verification steps
Use the Prometheus console to view targets and metrics.
For more information, see Using the expression browser.
6.2. Dev Workspace-specific metrics Copy linkLink copied to clipboard!
This section describes the Dev Workspace-specific metrics exposed by the devworkspace-controller-metrics service.
| Name | Type | Description | Labels |
|---|---|---|---|
|
| Counter | Number of Dev Workspace starting events. |
|
|
| Counter |
Number of Dev Workspaces successfully entering the |
|
|
| Counter | Number of failed Dev Workspaces. |
|
|
| Histogram | Total time taken to start a Dev Workspace, in seconds. |
|
| Name | Description | Values |
|---|---|---|
|
|
The |
|
|
|
The |
|
|
| The workspace startup failure reason. |
|
| Name | Description |
|---|---|
|
| Startup failure due to an invalid devfile used to create a Dev Workspace. |
|
|
Startup failure due to the following errors: |
|
| Unknown failure reason. |