diff --git a/test/instrumentation/README.md b/test/instrumentation/README.md index 80219cdba81..79059c928f2 100644 --- a/test/instrumentation/README.md +++ b/test/instrumentation/README.md @@ -26,8 +26,7 @@ To update the golden test list, you can run: ./test/instrumentation/test-update.sh ``` -To update the list of documented metrics (which you need to run first before -upgrading the documentation markdown file). +To update the list of documented metrics, please run: ```console ./test/instrumentation/update-documentation-metrics.sh diff --git a/test/instrumentation/doc.go b/test/instrumentation/doc.go new file mode 100644 index 00000000000..39f5916bda8 --- /dev/null +++ b/test/instrumentation/doc.go @@ -0,0 +1,29 @@ +/* +Copyright 2022 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. +*/ + +/* +This stand-alone package is utilized for dynamically generating/maintaining a list of +metrics; this list is determined by the stability class of the metric. We statically analyze +all files in the Kubernetes code base to: + - Determine whether the metric falls into a stability class with stability guarantees. + - Determine the metric's metadata, i.e. the name, labels, type of metric. + - Output (based on the above) the metrics which meet our criteria into a yaml file. + +Due to the dynamic nature of how metrics can be written, we only support the subset of metrics +which can actually be parsed. If a metric cannot be parsed, it must be delegated to the stability +class `Internal`, which will exempt the metric from static analysis. +*/ +package main diff --git a/test/instrumentation/documentation/doc.go b/test/instrumentation/documentation/doc.go new file mode 100644 index 00000000000..df64e65c53c --- /dev/null +++ b/test/instrumentation/documentation/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2022 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. +*/ + +/* +This stand-alone package is utilized for dynamically generating/maintaining +documentation on all parseable metrics in the Kubernetes code base. +*/ +package main diff --git a/test/instrumentation/documentation/documentation.md b/test/instrumentation/documentation/documentation.md index 1337a5949ef..b197b5b9e3f 100644 --- a/test/instrumentation/documentation/documentation.md +++ b/test/instrumentation/documentation/documentation.md @@ -13,7 +13,7 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu ### List of Stable Kubernetes Metrics - +
@@ -151,7 +151,7 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu ### List of Alpha Kubernetes Metrics -
Name
+
diff --git a/test/instrumentation/documentation/main.go b/test/instrumentation/documentation/main.go index 4abd3ffb760..417c0443b4f 100755 --- a/test/instrumentation/documentation/main.go +++ b/test/instrumentation/documentation/main.go @@ -55,7 +55,7 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu ### List of Stable Kubernetes Metrics -
Name
+
@@ -79,7 +79,7 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu ### List of Alpha Kubernetes Metrics -
Name
+
diff --git a/test/instrumentation/update-documentation.sh b/test/instrumentation/update-documentation.sh index f56a47a287d..eb6ef042527 100755 --- a/test/instrumentation/update-documentation.sh +++ b/test/instrumentation/update-documentation.sh @@ -25,4 +25,5 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. source "${KUBE_ROOT}/test/instrumentation/stability-utils.sh" +kube::update::documentation::list kube::update::documentation
Name