Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(RHTAPWATCH-592): Create a README in o11y/exporter/dsexporter/ and add blurb about exporters in the root README #173

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 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 @@ -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)
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 `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)