Skip to content

Conversation

dgmorales
Copy link
Contributor

@dgmorales dgmorales commented Sep 15, 2025

This PR instruments Keess code exporting metrics meant to be collected by Prometheus.

See metrics.go file for a description of the metrics being added here.

TODO (keep on draft while not complete):

  • Instrument orphan service handling
  • Count errors everywhere
  • Instrument ConfigMap orphan handling
  • Instrument Secret orphan handling
  • Track remote client state (keess_remote_up metrics)
  • Track resource management count (keess_resources_managed_total)

How this was tested

# Bring up the local clusters with Keess installed
# (or just `make install-keess` if cluster are already up)
make setup-local-clusters-with-keess

# Port forward into http service on the destination cluster (orphan metrics will show on the destination)
KUBECONFIG=localTestKubeconfig kubectl --context kind-destination-cluster -n keess port-forward services/keess 8080:8080

# Check the metrics (should be zeroed)
curl localhost:8080/metrics |grep keess

# Run our e2e test suite
make tests-e2e

# Check metrics again (should see increased numbers)

@dgmorales dgmorales requested a review from Copilot September 15, 2025 14:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Prometheus metrics instrumentation to Keess, enabling monitoring and observability of the operator's performance and health. The implementation includes metrics for error tracking, orphan resource detection/removal, and resource management counts.

Key changes:

  • Created comprehensive metrics package with Prometheus counters and gauges for various operational aspects
  • Instrumented service orphan handling with detection and removal metrics
  • Added HTTP endpoint for metrics exposure and updated service configuration for Prometheus scraping

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/keess/metrics/metrics.go New metrics package defining Prometheus counters and gauges for errors, orphans, and remote cluster status
pkg/keess/service/service_deletion.go Instrumented orphan service handling with metrics tracking
cmd/run.go Added metrics registration and HTTP endpoint for Prometheus scraping
cmd/version.go Version bump and variable export for metrics logging
chart/templates/service.yaml New Kubernetes service template with Prometheus scraping annotations
chart/values.yaml Added service configuration options for Prometheus integration
go.mod Added Prometheus client library dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 24 hours if no further activity occurs.
If this change is desirable, please accelerate completing it. If it is not, please close the PR. If you're blocked on something, please ensure there's a reference to this PR in a story on your team's board so the team will follow up, and consider closing the PR for now.
Please do not artificially extend the deadline with a dummy comment. If necessary, provide a status update, such as "this change is being actively tested".
Thank you for your contributions and your collaboration in reducing WIP and cycle time.

@github-actions github-actions bot added the Stale label Sep 30, 2025
@github-actions github-actions bot closed this Oct 4, 2025
@github-actions github-actions bot deleted the prometheus-exporter branch October 4, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant