Merge pull request #50123 from WIZARD-CXY/fixlog
Automatic merge from submit-queue (batch tested with PRs 51480, 49616, 50123, 50846, 50404) make get pod log with follow option as CONNECT verb **What this PR does / why we need it**: Don't make the get log with follow option request mix with GET pods request. Make it reported as a WATCH pod log request. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # Fixes #49998 ```release-note Pod log attempts are now reported in apiserver prometheus metrics with verb `CONNECT` since they can run for very long periods of time. ``` Kubernetes-commit: 00846fc7945aac7cb971522ee203ecd67dae4c45
This commit is contained in:
commit
f94923242e
|
|
@ -64,6 +64,12 @@ type action struct {
|
|||
AllNamespaces bool // true iff the action is namespaced but works on aggregate result for all namespaces
|
||||
}
|
||||
|
||||
// An interface to see if one storage supports override its default verb for monitoring
|
||||
type StorageMetricsOverride interface {
|
||||
// OverrideMetricsVerb gives a storage object an opportunity to override the verb reported to the metrics endpoint
|
||||
OverrideMetricsVerb(oldVerb string) (newVerb string)
|
||||
}
|
||||
|
||||
// An interface to see if an object supports swagger documentation as a method
|
||||
type documentable interface {
|
||||
SwaggerDoc() map[string]string
|
||||
|
|
@ -593,6 +599,9 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
}
|
||||
kind = fqParentKind.Kind
|
||||
}
|
||||
|
||||
verbOverrider, needOverride := storage.(StorageMetricsOverride)
|
||||
|
||||
switch action.Verb {
|
||||
case "GET": // Get a resource.
|
||||
var handler restful.RouteFunction
|
||||
|
|
@ -601,7 +610,14 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
} else {
|
||||
handler = restfulGetResource(getter, exporter, reqScope)
|
||||
}
|
||||
handler = metrics.InstrumentRouteFunc(action.Verb, resource, subresource, namespaceScope, handler)
|
||||
|
||||
if needOverride {
|
||||
// need change the reported verb
|
||||
handler = metrics.InstrumentRouteFunc(verbOverrider.OverrideMetricsVerb(action.Verb), resource, subresource, namespaceScope, handler)
|
||||
} else {
|
||||
handler = metrics.InstrumentRouteFunc(action.Verb, resource, subresource, namespaceScope, handler)
|
||||
}
|
||||
|
||||
if a.enableAPIResponseCompression {
|
||||
handler = genericfilters.RestfulWithCompression(handler, a.group.Context)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue