"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go" between
kubernetes-1.15.9.tar.gz and kubernetes-1.15.10.tar.gz

About: Kubernetes is a platform for automating deployment, scaling, and operations of application containers across clusters of hosts (written in "Go"). 1.15.x series.

metrics.go  (kubernetes-1.15.9):metrics.go  (kubernetes-1.15.10)
skipping to change at line 32 skipping to change at line 32
"net/http" "net/http"
"net/url" "net/url"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
"k8s.io/apimachinery/pkg/apis/meta/v1/validation" "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
utilnet "k8s.io/apimachinery/pkg/util/net"
utilsets "k8s.io/apimachinery/pkg/util/sets" utilsets "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/features"
utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeature "k8s.io/apiserver/pkg/util/feature"
restful "github.com/emicklei/go-restful" restful "github.com/emicklei/go-restful"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )
// resettableCollector is the interface implemented by prometheus.MetricVec // resettableCollector is the interface implemented by prometheus.MetricVec
skipping to change at line 251 skipping to change at line 250
g.Inc() g.Inc()
defer g.Dec() defer g.Dec()
fn() fn()
} }
// MonitorRequest handles standard transformations for client and the reported v erb and then invokes Monitor to record // MonitorRequest handles standard transformations for client and the reported v erb and then invokes Monitor to record
// a request. verb must be uppercase to be backwards compatible with existing mo nitoring tooling. // a request. verb must be uppercase to be backwards compatible with existing mo nitoring tooling.
func MonitorRequest(req *http.Request, verb, group, version, resource, subresour ce, scope, component, contentType string, httpCode, respSize int, elapsed time.D uration) { func MonitorRequest(req *http.Request, verb, group, version, resource, subresour ce, scope, component, contentType string, httpCode, respSize int, elapsed time.D uration) {
reportedVerb := cleanVerb(verb, req) reportedVerb := cleanVerb(verb, req)
dryRun := cleanDryRun(req.URL) dryRun := cleanDryRun(req.URL)
client := cleanUserAgent(utilnet.GetHTTPClient(req)) // blank out client string here, in order to avoid cardinality issues
client := ""
elapsedMicroseconds := float64(elapsed / time.Microsecond) elapsedMicroseconds := float64(elapsed / time.Microsecond)
elapsedSeconds := elapsed.Seconds() elapsedSeconds := elapsed.Seconds()
requestCounter.WithLabelValues(reportedVerb, dryRun, group, version, reso urce, subresource, scope, component, client, contentType, codeToString(httpCode) ).Inc() requestCounter.WithLabelValues(reportedVerb, dryRun, group, version, reso urce, subresource, scope, component, client, contentType, codeToString(httpCode) ).Inc()
deprecatedRequestCounter.WithLabelValues(reportedVerb, group, version, re source, subresource, scope, component, client, contentType, codeToString(httpCod e)).Inc() deprecatedRequestCounter.WithLabelValues(reportedVerb, group, version, re source, subresource, scope, component, client, contentType, codeToString(httpCod e)).Inc()
requestLatencies.WithLabelValues(reportedVerb, dryRun, group, version, re source, subresource, scope, component).Observe(elapsedSeconds) requestLatencies.WithLabelValues(reportedVerb, dryRun, group, version, re source, subresource, scope, component).Observe(elapsedSeconds)
deprecatedRequestLatencies.WithLabelValues(reportedVerb, group, version, resource, subresource, scope, component).Observe(elapsedMicroseconds) deprecatedRequestLatencies.WithLabelValues(reportedVerb, group, version, resource, subresource, scope, component).Observe(elapsedMicroseconds)
deprecatedRequestLatenciesSummary.WithLabelValues(reportedVerb, group, ve rsion, resource, subresource, scope, component).Observe(elapsedMicroseconds) deprecatedRequestLatenciesSummary.WithLabelValues(reportedVerb, group, ve rsion, resource, subresource, scope, component).Observe(elapsedMicroseconds)
// We are only interested in response sizes of read requests. // We are only interested in response sizes of read requests.
if verb == "GET" || verb == "LIST" { if verb == "GET" || verb == "LIST" {
responseSizes.WithLabelValues(reportedVerb, group, version, resou rce, subresource, scope, component).Observe(float64(respSize)) responseSizes.WithLabelValues(reportedVerb, group, version, resou rce, subresource, scope, component).Observe(float64(respSize))
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)