mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Update comments
This commit is contained in:
parent
00c093074c
commit
fdff124fb1
1 changed files with 1 additions and 3 deletions
|
|
@ -46,7 +46,7 @@ var (
|
||||||
[]string{"path", "server"},
|
[]string{"path", "server"},
|
||||||
)
|
)
|
||||||
|
|
||||||
// define a counter for API errors for various ErrorTypes
|
// define a counter for api requests
|
||||||
apiRequestsTotal = metrics.NewCounterVec(
|
apiRequestsTotal = metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Namespace: "prometheus_adapter",
|
Namespace: "prometheus_adapter",
|
||||||
|
|
@ -94,10 +94,8 @@ func (c *instrumentedGenericClient) Do(ctx context.Context, verb, endpoint strin
|
||||||
endTime := time.Now()
|
endTime := time.Now()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if apiErr, wasAPIErr := err.(*client.Error); wasAPIErr {
|
if apiErr, wasAPIErr := err.(*client.Error); wasAPIErr {
|
||||||
// measure API errors
|
|
||||||
apiRequestsTotal.With(prometheus.Labels{"code": string(apiErr.Type), "path": endpoint, "server": c.serverName}).Inc()
|
apiRequestsTotal.With(prometheus.Labels{"code": string(apiErr.Type), "path": endpoint, "server": c.serverName}).Inc()
|
||||||
} else {
|
} else {
|
||||||
// increment a generic error code counter
|
|
||||||
apiRequestsTotal.With(prometheus.Labels{"code": "generic", "path": endpoint, "server": c.serverName}).Inc()
|
apiRequestsTotal.With(prometheus.Labels{"code": "generic", "path": endpoint, "server": c.serverName}).Inc()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue