instrument k8s-prometheus-adapter to expose prometheus metrics

fixes #218
This commit is contained in:
pdbogen 2019-07-19 16:12:29 -07:00
parent 28a807aa9f
commit cbba53e16b
11 changed files with 308 additions and 14 deletions

18
pkg/errors/errors.go Normal file
View file

@ -0,0 +1,18 @@
package errors
import (
"github.com/directxman12/k8s-prometheus-adapter/pkg/metrics"
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/provider"
apierr "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func NewMetricNotFoundError(resource schema.GroupResource, metricName string) error {
metrics.Errors.WithLabelValues("not_found").Inc()
return provider.NewMetricNotFoundError(resource, metricName)
}
func NewInternalError(err error) *apierr.StatusError {
metrics.Errors.WithLabelValues("internal").Inc()
return apierr.NewInternalError(err)
}