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

Implement Prometheus instrumentation for Flux resources #54

Merged
merged 6 commits into from
Jun 28, 2024
Merged

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Jun 23, 2024

This PR improves the observability capabilities of the operator by exporting Prometheus metrics for Flux instance and Flux custom resources. These metrics can be used to monitor both the Flux installation and the Flux-managed deployments, giving users a holistic status report of the cluster state reconciliation.

In addition, this PR makes the operator conform with OpenShift/OLM “Deep Insights” requirements.

Closes: #53

Flux Instance Metrics

The Flux Operator exports metrics for the FluxInstance resource.
These metrics are refreshed every time the operator reconciles the instance.

Metrics:

flux_instance_info{uid, kind, name, exported_namespace, ready, suspended, registry, revision}

Labels:

  • uid: The Kubernetes unique identifier of the resource.
  • kind: The kind of the resource (e.g. FluxInstance).
  • name: The name of the resource (e.g. flux).
  • exported_namespace: The namespace where the resource is deployed (e.g. flux-system).
  • ready: The readiness status of the resource (e.g. True, False or Unkown).
  • reason: The reason for the readiness status (e.g. Progressing, BuildFailed, HealthCheckFailed, etc.).
  • suspended: The suspended status of the resource (e.g. True or False).
  • registry: The container registry used by the instance (e.g. ghcr.io/fluxcd).
  • revision: The Flux revision installed by the instance (e.g. v2.3.0@sha256:75aa209c6a...).

Flux Resource Metrics

The Flux Operator exports metrics for all Flux resources found in the cluster.
These metrics are refreshed at the same time with the update of the FluxReport.

Metrics:

flux_resource_info{uid, kind, name, exported_namespace, ready, suspended, ...}

Common labels:

  • uid: The Kubernetes unique identifier of the resource.
  • kind: The kind of the resource (e.g. GitRepository, Kustomization, etc.).
  • name: The name of the resource (e.g. flux-system).
  • exported_namespace: The namespace of the resource (e.g. flux-system).
  • ready: The readiness status of the resource (e.g. True, False or Unkown).
  • reason: The reason for the readiness status (e.g. Progressing, BuildFailed, HealthCheckFailed, etc.).
  • suspended: The suspended status of the resource (e.g. True or False).

Specific labels per resource kind:

Resource Kind Labels
Kustomization revision, source_name, path
GitRepository revision, url, ref
OCIRepository revision, url, ref
Bucket revision, url, ref
HelmRelease revision, source_name
HelmChart revision, source_name
HelmRepository revision, url
Receiver url
ImageRepository url
ImagePolicy source_name
ImageUpdateAutomation source_name

@stefanprodan stefanprodan added the area/observability Reporting, metrics, logs and events related issues and pull requests label Jun 23, 2024
@stefanprodan stefanprodan force-pushed the metrics branch 3 times, most recently from 7904904 to 674c177 Compare June 23, 2024 13:31
@stefanprodan stefanprodan force-pushed the metrics branch 2 times, most recently from e4b8239 to 0436785 Compare June 24, 2024 06:14
@stefanprodan stefanprodan requested a review from souleb June 24, 2024 08:04
Copy link
Contributor

@souleb souleb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan merged commit f2f9665 into main Jun 28, 2024
2 checks passed
@stefanprodan stefanprodan deleted the metrics branch June 28, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/observability Reporting, metrics, logs and events related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export metrics for Flux reconcilers
2 participants