Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated metric and promote the replacement to STABLE #110310

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 5 additions & 21 deletions staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,7 @@ var (
&compbasemetrics.GaugeOpts{
Name: "apiserver_longrunning_requests",
Help: "Gauge of all active long-running apiserver requests broken out by verb, group, version, resource, scope and component. Not all requests are tracked this way.",
StabilityLevel: compbasemetrics.ALPHA,
},
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
)
longRunningRequestGauge = compbasemetrics.NewGaugeVec(
&compbasemetrics.GaugeOpts{
Name: "apiserver_longrunning_gauge",
Help: "Gauge of all active long-running apiserver requests broken out by verb, group, version, resource, scope and component. Not all requests are tracked this way.",
StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.23.0",
StabilityLevel: compbasemetrics.STABLE,
},
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
)
Expand Down Expand Up @@ -271,7 +262,6 @@ var (
deprecatedRequestGauge,
requestCounter,
longRunningRequestsGauge,
longRunningRequestGauge,
requestLatencies,
requestSloLatencies,
fieldValidationRequestLatencies,
Expand Down Expand Up @@ -474,7 +464,7 @@ func RecordLongRunning(req *http.Request, requestInfo *request.RequestInfo, comp
if requestInfo == nil {
requestInfo = &request.RequestInfo{Verb: req.Method, Path: req.URL.Path}
}
var g, e compbasemetrics.GaugeMetric
var g compbasemetrics.GaugeMetric
scope := CleanScope(requestInfo)

// We don't use verb from <requestInfo>, as this may be propagated from
Expand All @@ -484,18 +474,12 @@ func RecordLongRunning(req *http.Request, requestInfo *request.RequestInfo, comp
reportedVerb := cleanVerb(CanonicalVerb(strings.ToUpper(req.Method), scope), getVerbIfWatch(req), req)

if requestInfo.IsResourceRequest {
e = longRunningRequestsGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, requestInfo.APIGroup, requestInfo.APIVersion, requestInfo.Resource, requestInfo.Subresource, scope, component)
g = longRunningRequestGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, requestInfo.APIGroup, requestInfo.APIVersion, requestInfo.Resource, requestInfo.Subresource, scope, component)
g = longRunningRequestsGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, requestInfo.APIGroup, requestInfo.APIVersion, requestInfo.Resource, requestInfo.Subresource, scope, component)
} else {
e = longRunningRequestsGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, "", "", "", requestInfo.Path, scope, component)
g = longRunningRequestGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, "", "", "", requestInfo.Path, scope, component)
g = longRunningRequestsGauge.WithContext(req.Context()).WithLabelValues(reportedVerb, "", "", "", requestInfo.Path, scope, component)
}
e.Inc()
g.Inc()
defer func() {
e.Dec()
g.Dec()
}()
defer g.Dec()
fn()
}

Expand Down
13 changes: 13 additions & 0 deletions test/instrumentation/testdata/stable-metrics-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@
stabilityLevel: STABLE
labels:
- request_kind
- name: apiserver_longrunning_requests
help: Gauge of all active long-running apiserver requests broken out by verb, group,
version, resource, scope and component. Not all requests are tracked this way.
type: Gauge
stabilityLevel: STABLE
labels:
- component
- group
- resource
- scope
- subresource
- verb
- version
- name: apiserver_request_duration_seconds
help: Response latency distribution in seconds for each verb, dry run value, group,
version, resource, subresource, scope and component.
Expand Down