Skip to content

Commit

Permalink
Remove prometheus counter github_requests
Browse files Browse the repository at this point in the history
With the histogram `github_request_duration` which comes with a
counter already, the counter `github_requests` is no longer needed.
  • Loading branch information
hongkailiu committed Aug 13, 2019
1 parent 2334826 commit a2677bd
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions ghproxy/ghmetrics/ghmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ var ghTokenUsageGaugeVec = prometheus.NewGaugeVec(
[]string{"token_hash", "api_version"},
)

// ghRequestsCounter provides the 'github_requests' counter that keeps track
// of the number of GitHub requests by API path.
var ghRequestsCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "github_requests",
Help: "GitHub requests by API path.",
},
[]string{"token_hash", "path", "status"},
)

// ghRequestDurationHistVec provides the 'github_request_duration' histogram that keeps track
// of the duration of GitHub requests by API path.
var ghRequestDurationHistVec = prometheus.NewHistogramVec(
Expand All @@ -73,7 +63,6 @@ var lastGitHubResponse time.Time
func init() {
prometheus.MustRegister(ghTokenUntilResetGaugeVec)
prometheus.MustRegister(ghTokenUsageGaugeVec)
prometheus.MustRegister(ghRequestsCounter)
prometheus.MustRegister(ghRequestDurationHistVec)
}

Expand Down Expand Up @@ -106,7 +95,6 @@ func CollectGitHubTokenMetrics(tokenHash, apiVersion string, headers http.Header
// CollectGitHubRequestMetrics publishes the number of requests by API path to
// `github_requests` on prometheus.
func CollectGitHubRequestMetrics(tokenHash, path, statusCode string, roundTripTime float64) {
ghRequestsCounter.With(prometheus.Labels{"token_hash": tokenHash, "path": GetSimplifiedPath(path), "status": statusCode}).Inc()
ghRequestDurationHistVec.With(prometheus.Labels{"token_hash": tokenHash, "path": GetSimplifiedPath(path), "status": statusCode}).Observe(roundTripTime)
}

Expand Down

0 comments on commit a2677bd

Please sign in to comment.