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

Add a metrics of GitHub Apps installation #222

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

whywaita
Copy link
Owner

@whywaita whywaita commented Dec 5, 2024

This pull request includes significant changes to the GitHub integration and Prometheus metrics collection. The most important changes are the addition of new functions for listing GitHub installations and enhancements to the Prometheus metrics for datastore and GitHub installations.

GitHub Integration Enhancements:

  • Added a new function listInstallations in pkg/gh/installation.go to list GitHub installations with caching to improve performance.
  • Removed the redundant listInstallations function from pkg/gh/jwt.go as it was moved to pkg/gh/installation.go.

Prometheus Metrics Enhancements:

  • Added new Prometheus metrics descriptors for datastore targets and token expiration times in pkg/metric/scrape_datastore.go.
  • Updated the scrapeTargets function in pkg/metric/scrape_datastore.go to include the new metrics for datastore targets and token expiration times.
  • Introduced a new Prometheus metric descriptor for GitHub installations in pkg/metric/scrape_github.go.
  • Added a new function scrapeInstallation in pkg/metric/scrape_github.go to scrape and collect metrics for GitHub installations.
  • Updated the Scrape function in pkg/metric/scrape_github.go to include the new scrapeInstallation function.This pull request introduces new functionality for caching GitHub installations and adds new Prometheus metrics for monitoring. The main changes include the addition of a new method to list and cache GitHub installations, the removal of the old method, and the introduction of new Prometheus metrics for both datastore targets and GitHub installations.

Caching GitHub Installations:

  • pkg/gh/installation.go: Added a new method listInstallations that caches the result of GitHub installations for one hour to improve performance.
  • pkg/gh/jwt.go: Removed the old listInstallations method as it has been replaced by the new method in installation.go.

Prometheus Metrics:

  • pkg/metric/scrape_datastore.go: Added a new Prometheus metric datastoreTargetDesc to describe datastore targets and updated the scrapeTargets function to use this new metric. [1] [2]
  • pkg/metric/scrape_github.go: Added a new Prometheus metric githubInstallationDesc to describe GitHub installations and updated the ScraperGitHub to scrape installation metrics using the new scrapeInstallation function. [1] [2] [3]

Copy link
Collaborator

@gamoutatsumi gamoutatsumi left a comment

Choose a reason for hiding this comment

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

LGTM

@whywaita whywaita merged commit 5d80441 into fix/pending-log Dec 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants