Skip to content

Commit 834b08a

Browse files
Gerry-FordelinfrazeAndrienkoAleksandr
authored
RHIDP-5421 - Document which plugins in RHDH have metrics (#1110)
* RHIDP-5421 - Document which plugins in RHDH have metrics * Update artifacts/rhdh-plugins-reference/keycloak/keycloak-plugin-admin.adoc Co-authored-by: Lindsey Frazier <[email protected]> * Update artifacts/rhdh-plugins-reference/keycloak/keycloak-plugin-admin.adoc Co-authored-by: Lindsey Frazier <[email protected]> * RHIDP-5421 - Document which plugins in RHDH have metrics * RHIDP-5421 - Document which plugins in RHDH have metrics * RHIDP-5421 - Document which plugins in RHDH have metrics * Update artifacts/rhdh-plugins-reference/keycloak/keycloak-plugin-admin.adoc Co-authored-by: Oleksandr Andriienko <[email protected]> --------- Co-authored-by: Lindsey Frazier <[email protected]> Co-authored-by: Oleksandr Andriienko <[email protected]>
1 parent 3722de2 commit 834b08a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

artifacts/rhdh-plugins-reference/keycloak/keycloak-plugin-admin.adoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,64 @@ When using client credentials, the access type must be set to `confidential` and
143143
* `query-users`
144144
* `view-users`
145145

146+
== Metrics
147+
148+
The Keycloak backend plugin supports link:https://opentelemetry.io/[OpenTelemetry] metrics that you can use to monitor fetch operations and diagnose potential issues.
149+
150+
=== Available Counters
151+
152+
.Keycloak metrics
153+
[cols="60%,40%", frame="all", options="header"]
154+
|===
155+
|Metric Name
156+
|Description
157+
| `backend_keycloak_fetch_task_failure_count_total` | Counts fetch task failures where no data was returned due to an error.
158+
| `backend_keycloak_fetch_data_batch_failure_count_total` | Counts partial data batch failures. Even if some batches fail, the plugin continues fetching others.
159+
|===
160+
161+
=== Labels
162+
163+
All counters include the `taskInstanceId` label, which uniquely identifies each scheduled fetch task. You can use this label to trace failures back to individual task executions.
164+
165+
Users can enter queries in the Prometheus UI or Grafana to explore and manipulate metric data.
166+
167+
In the following examples, a Prometheus Query Language (PromQL) expression returns the number of backend failures.
168+
169+
.Example to get the number of backend failures associated with a `taskInstanceId`
170+
[source,subs="+attributes,+quotes"]
171+
----
172+
backend_keycloak_fetch_data_batch_failure_count_total{taskInstanceId="df040f82-2e80-44bd-83b0-06a984ca05ba"} 1
173+
----
174+
175+
.Example to get the number of backend failures during the last hour
176+
177+
[source,subs="+attributes,+quotes"]
178+
----
179+
sum(backend_keycloak_fetch_data_batch_failure_count_total) - sum(backend_keycloak_fetch_data_batch_failure_count_total offset 1h)
180+
----
181+
182+
[NOTE]
183+
====
184+
PromQL supports arithmetic operations, comparison operators, logical/set operations, aggregation, and various functions. Users can combine these features to analyze time-series data effectively.
185+
186+
Additionally, the results can be visualized using Grafana.
187+
====
188+
189+
// === Use Case Example
190+
191+
// Imagine your Keycloak instance is under-provisioned (e.g., low CPU/RAM limits), and the plugin is configured to send many parallel API requests.
192+
// This could cause request timeouts or throttling. The metrics described above can help detect such behavior early, allowing administrators to:
193+
194+
// - Tune the plugin configuration (e.g., reduce parallelism)
195+
// - Increase resources on the Keycloak server
196+
// - Investigate network or permission issues
197+
198+
=== Exporting Metrics
199+
200+
You can export metrics using any OpenTelemetry-compatible backend, such as *Prometheus*.
201+
202+
See the link:https://backstage.io/docs/tutorials/setup-opentelemetry[Backstage OpenTelemetry setup guide] for integration instructions.
203+
146204
== Limitations
147205

148206
If you have self-signed or corporate certificate issues, you can set the following environment variable before starting {product-short}:

0 commit comments

Comments
 (0)