mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
instrument metrics
This commit is contained in:
parent
57b07c911b
commit
2ba4422ea4
1 changed files with 18 additions and 18 deletions
|
|
@ -93,10 +93,10 @@ func (c *instrumentedGenericClient) Do(ctx context.Context, verb, endpoint strin
|
||||||
// skip calls where we don't make the actual request
|
// skip calls where we don't make the actual request
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if apiErr, wasAPIErr := err.(*client.Error); wasAPIErr {
|
if apiErr, wasAPIErr := err.(*client.Error); wasAPIErr {
|
||||||
// Measure API errors
|
// measure API errors
|
||||||
apiErrorCount.With(prometheus.Labels{"error_code": string(apiErr.Type), "path": endpoint, "server": c.serverName}).Inc()
|
apiErrorCount.With(prometheus.Labels{"error_code": string(apiErr.Type), "path": endpoint, "server": c.serverName}).Inc()
|
||||||
} else {
|
} else {
|
||||||
// Increment a generic error code counter
|
// increment a generic error code counter
|
||||||
apiErrorCount.With(prometheus.Labels{"error_code": "generic", "path": endpoint, "server": c.serverName}).Inc()
|
apiErrorCount.With(prometheus.Labels{"error_code": "generic", "path": endpoint, "server": c.serverName}).Inc()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue