|
| 1 | +// This module is included in the following assembly: |
| 2 | +// |
| 3 | +// *cicd/pipelines/creating-applications-with-cicd-pipelines.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="enabling-monitoring-of-event-listeners-for-triggers-for-user-defined-projects_{context}"] |
| 7 | += Enabling monitoring of event listeners for Triggers for user-defined projects |
| 8 | + |
| 9 | +As a cluster administrator, to gather event listener metrics for the `Triggers` service in a user-defined project and display them in the {product-title} web console, you can create a service monitor for each event listener. On receiving a HTTP request, event listeners for the `Triggers` service return three metrics -- `eventlistener_http_duration_seconds`, `eventlistener_event_count`, and `eventlistener_triggered_resources`. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You have logged in to the {product-title} web console. |
| 14 | +* You have installed the {pipelines-title} Operator. |
| 15 | +* You have enabled monitoring for user-defined projects. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +. For each event listener, create a service monitor. For example, to view the metrics for the `github-listener` event listener in the `test` namespace, create the following service monitor: |
| 20 | ++ |
| 21 | +[source,yaml] |
| 22 | +---- |
| 23 | +apiVersion: monitoring.coreos.com/v1 |
| 24 | +kind: ServiceMonitor |
| 25 | +metadata: |
| 26 | + labels: |
| 27 | + app.kubernetes.io/managed-by: EventListener |
| 28 | + app.kubernetes.io/part-of: Triggers |
| 29 | + eventlistener: github-listener |
| 30 | + annotations: |
| 31 | + networkoperator.openshift.io/ignore-errors: "" |
| 32 | + name: el-monitor |
| 33 | + namespace: test |
| 34 | +spec: |
| 35 | + endpoints: |
| 36 | + - interval: 10s |
| 37 | + port: http-metrics |
| 38 | + jobLabel: name |
| 39 | + namespaceSelector: |
| 40 | + matchNames: |
| 41 | + - test |
| 42 | + selector: |
| 43 | + matchLabels: |
| 44 | + app.kubernetes.io/managed-by: EventListener |
| 45 | + app.kubernetes.io/part-of: Triggers |
| 46 | + eventlistener: github-listener |
| 47 | +... |
| 48 | +---- |
| 49 | +. Test the service monitor by sending a request to the event listener. For example, push an empty commit: |
| 50 | ++ |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +$ git commit -m "empty-commit" --allow-empty && git push origin main |
| 54 | +---- |
| 55 | +. On the {product-title} web console, navigate to **Administrator** -> **Observe** -> **Metrics**. |
| 56 | +. To view a metric, search by its name. For example, to view the details of the `eventlistener_http_resources` metric for the `github-listener` event listener, search using the `eventlistener_http_resources` keyword. |
0 commit comments