Add a metrics of GitHub Apps installation #222
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
listInstallations
inpkg/gh/installation.go
to list GitHub installations with caching to improve performance.listInstallations
function frompkg/gh/jwt.go
as it was moved topkg/gh/installation.go
.Prometheus Metrics Enhancements:
pkg/metric/scrape_datastore.go
.scrapeTargets
function inpkg/metric/scrape_datastore.go
to include the new metrics for datastore targets and token expiration times.pkg/metric/scrape_github.go
.scrapeInstallation
inpkg/metric/scrape_github.go
to scrape and collect metrics for GitHub installations.Scrape
function inpkg/metric/scrape_github.go
to include the newscrapeInstallation
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 methodlistInstallations
that caches the result of GitHub installations for one hour to improve performance.pkg/gh/jwt.go
: Removed the oldlistInstallations
method as it has been replaced by the new method ininstallation.go
.Prometheus Metrics:
pkg/metric/scrape_datastore.go
: Added a new Prometheus metricdatastoreTargetDesc
to describe datastore targets and updated thescrapeTargets
function to use this new metric. [1] [2]pkg/metric/scrape_github.go
: Added a new Prometheus metricgithubInstallationDesc
to describe GitHub installations and updated theScraperGitHub
to scrape installation metrics using the newscrapeInstallation
function. [1] [2] [3]