-
Notifications
You must be signed in to change notification settings - Fork 39.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81786 from sttts/sttts-openapi-log-why
aggregator/apiextensions: logs & metrics why OpenAPI spec is regenerated
- Loading branch information
Showing
7 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/metrics.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package openapi | ||
|
||
import ( | ||
"k8s.io/component-base/metrics" | ||
"k8s.io/component-base/metrics/legacyregistry" | ||
) | ||
|
||
var ( | ||
regenerationCounter = metrics.NewCounterVec( | ||
&metrics.CounterOpts{ | ||
Name: "apiextensions_openapi_v2_regeneration_count", | ||
Help: "Counter of OpenAPI v2 spec regeneration count broken down by causing CRD name and reason.", | ||
StabilityLevel: metrics.ALPHA, | ||
}, | ||
[]string{"crd", "reason"}, | ||
) | ||
) | ||
|
||
func init() { | ||
legacyregistry.MustRegister(regenerationCounter) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
staging/src/k8s.io/kube-aggregator/pkg/controllers/openapi/aggregator/metrics.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package aggregator | ||
|
||
import ( | ||
"k8s.io/component-base/metrics" | ||
"k8s.io/component-base/metrics/legacyregistry" | ||
) | ||
|
||
var ( | ||
regenerationCounter = metrics.NewCounterVec( | ||
&metrics.CounterOpts{ | ||
Name: "aggregator_openapi_v2_regeneration_count", | ||
Help: "Counter of OpenAPI v2 spec regeneration count broken down by causing APIService name and reason.", | ||
StabilityLevel: metrics.ALPHA, | ||
}, | ||
[]string{"apiservice", "reason"}, | ||
) | ||
regenerationDurationGauge = metrics.NewGaugeVec( | ||
&metrics.GaugeOpts{ | ||
Name: "aggregator_openapi_v2_regeneration_duration", | ||
Help: "Gauge of OpenAPI v2 spec regeneration duration in seconds.", | ||
StabilityLevel: metrics.ALPHA, | ||
}, | ||
[]string{"reason"}, | ||
) | ||
) | ||
|
||
func init() { | ||
legacyregistry.MustRegister(regenerationCounter) | ||
legacyregistry.MustRegister(regenerationDurationGauge) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters