...

Source file src/k8s.io/kubernetes/test/instrumentation/doc.go

Documentation: k8s.io/kubernetes/test/instrumentation

     1  /*
     2  Copyright 2022 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  /*
    18  This stand-alone package is utilized for dynamically generating/maintaining a list of
    19  metrics; this list is determined by the stability class of the metric. We statically analyze
    20  all files in the Kubernetes code base to:
    21    - Determine whether the metric falls into a stability class with stability guarantees.
    22    - Determine the metric's metadata, i.e. the name, labels, type of metric.
    23    - Output (based on the above) the metrics which meet our criteria into a yaml file.
    24  
    25  Due to the dynamic nature of how metrics can be written, we only support the subset of metrics
    26  which can actually be parsed. If a metric cannot be parsed, it must be delegated to the stability
    27  class `Internal`, which will exempt the metric from static analysis.
    28  
    29  The entrypoint to this package is defined in a shell script (i.e. stability-utils.sh) which has
    30  the logic for feeding file names as arguments into the program. The logic of this program is as
    31  follows:
    32  
    33    - parse all files fed in, keeping track of:
    34    - the function and struct pointers which correspond to prometheus metric definitions.
    35    - consts/variable we encounter, so that we can use these to resolve values in metric definitions
    36    - then, iterate over the function and struct pointers, resolving attributes to concrete metric values
    37    - then, using our collected and resolved metric definitions, output (depending on the mode):
    38    - a yaml file corresponding to all stable metrics
    39    - a documentation file corresponding to all parseable metrics in the Kubernetes codebase
    40  */
    41  package main
    42  

View as plain text