diff --git a/README.md b/README.md index 6d12f6d0..625fd251 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This repository contains the following definitions for RHTAP: * Prometheus alerting rules (deployed to RHOBS) * Grafana dashboards (deployed to AppSRE's Grafana) + * Availability exporters ## Alerting Rules @@ -125,8 +126,24 @@ to RHOBS. If additional metrics or labels are needed, add them by following the described in the [monitoring stack documentation](https://github.com/redhat-appstudio/infra-deployments/blob/main/components/monitoring/prometheus/README.md#federation-and-remote-write) +## Availability exporters + +In order to be able to evaluate the overall availability of the Konflux ecosystem, we +need to be able to establish the availability of each of its components. + +By leveraging the existing [Konflux monitoring stack](https://gitlab.cee.redhat.com/konflux/docs/documentation/-/blob/main/o11y/monitoring/monitoring.md) +based on Prometheus, we create Prometheus exporters that generate metrics that are +scraped by the User Workload Monitoring Prometheus instance and remote-written to RHOBS. + +### Availability Exporter Example +The o11y team provides an example availability exporter that can be used as reference, +especially in the case in which the exporter is external to the code it's monitoring. + +- [Exporter code](https://github.com/redhat-appstudio/o11y/tree/main/exporters/dsexporter) +- [Exporter and service Monitor Kubernetes Resources](https://github.com/redhat-appstudio/o11y/tree/main/config/exporters/monitoring/grafana/base) + +For more detailed documentation on [Availability exporters](https://gitlab.cee.redhat.com/konflux/docs/documentation/-/blob/main/o11y/monitoring/availability_exporters.md?ref_type=heads) + ## Support -The RHTAP o11y team maintains this repository. -Reach out to us on our [slack channel](https://redhat-internal.slack.com/archives/C04FDFTF8EB) -for further assistance. +- Slack: [#forum-konflux-o11y](https://app.slack.com/client/E030G10V24F/C04FDFTF8EB) diff --git a/exporters/dsexporter/README.md b/exporters/dsexporter/README.md new file mode 100644 index 00000000..b376b83b --- /dev/null +++ b/exporters/dsexporter/README.md @@ -0,0 +1,37 @@ +# Prometheus Exporters + +Prometheus exporters expose metrics from a system or an application in a format that can +be scraped and monitored by Prometheus. The exporter may be an integral part of the +component that it's monitoring (self-instrumenting), or it can generate metrics for +another system/component. + +## Availability Exporter + +In the context of the Konflux ecosystem, the `dsexporter` serves as an +[Availability Exporter](https://gitlab.cee.redhat.com/konflux/docs/documentation/-/blob/main/o11y/monitoring/availability_exporters.md), +contributing to the evaluation of the availability of each component within the system. +By exposing this metric, it allows for monitoring and analyzing the +workload and performance of the associated service. + +## dsexporter + +This `datasource exporter file (dsexporter.go)` exposes a single metric named `"konflux_up"` +that checks if the grafana datasource `"prometheus-appstudio-ds"` is available or not. +This metric has two labels `"service"` and `"check"` which are constant for a given time +series.The exporter implements a custom Prometheus collector named `CustomCollector`, +which implements the `prometheus.Collector` interface. The `CustomCollector` struct +has a konfluxUp field to check the availability of grafana datasource. It implements +the `Describe` method to provide descriptions of the metrics to Prometheus and `Collect` +method to send the current values of the metrics to Prometheus. + +The `test case file (dsexporter_test.go)` tests the functionality of the different functions +impelemented in dsexporter.go. + +This code provides a simple example of how to create a custom Prometheus exporter and test its +functionality in Go. It is useful for monitoring the performance and behavior of the overall +availability of the Konflux ecosystem. + +The o11y team provides an example availability exporter that can be used as reference below: + +* [Exporter code](https://github.com/redhat-appstudio/o11y/tree/main/exporters/dsexporter) +* [Exporter and Service Monitor Kubernetes Resources](https://github.com/redhat-appstudio/o11y/tree/main/config/exporters/monitoring/grafana/base)