Update comments

This commit is contained in:
cerberus20 2024-05-06 09:19:59 +05:30 committed by GitHub
parent 00c093074c
commit fdff124fb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,7 +46,7 @@ var (
[]string{"path", "server"},
)
// define a counter for API errors for various ErrorTypes
// define a counter for api requests
apiRequestsTotal = metrics.NewCounterVec(
&metrics.CounterOpts{
Namespace: "prometheus_adapter",
@ -94,10 +94,8 @@ func (c *instrumentedGenericClient) Do(ctx context.Context, verb, endpoint strin
endTime := time.Now()
if err != nil {
if apiErr, wasAPIErr := err.(*client.Error); wasAPIErr {
// measure API errors
apiRequestsTotal.With(prometheus.Labels{"code": string(apiErr.Type), "path": endpoint, "server": c.serverName}).Inc()
} else {
// increment a generic error code counter
apiRequestsTotal.With(prometheus.Labels{"code": "generic", "path": endpoint, "server": c.serverName}).Inc()
}
return