Skip to content

Commit

Permalink
chore(RHTAPWATCH-592): Create a README.md under o11y/exporters and bl…
Browse files Browse the repository at this point in the history
…urb about exporters in the root README.md

Signed-off-by: Kousalya Lakshmanan <[email protected]>
  • Loading branch information
klakshma21 committed Feb 5, 2024
1 parent b2e39a4 commit 01bd84c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -124,8 +125,25 @@ 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)

37 changes: 37 additions & 0 deletions exporters/dsexporter/README.md
Original file line number Diff line number Diff line change
@@ -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 `dummy service exporter file (dsexporter.go)` exposes a single metric named
"request_count" that counts the number of requests handled by the service.
The exporter implements a custom Prometheus collector named `CustomCollector`,
which implements the `prometheus.Collector` interface. The CustomCollector struct
has a requestCounter field to track the number of requests. 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 (main_test.go)` tests the functionality of the CustomCollector.
It verifies that the `request_count` metric initially has a value of 0 and then
increments to 1 after simulating a request.

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)

0 comments on commit 01bd84c

Please sign in to comment.