include beta metrics in documentation and update docs for metrics

This commit is contained in:
Han Kang
2023-03-01 11:32:19 -08:00
parent 60eefa8066
commit 0199276f85
3 changed files with 530 additions and 117 deletions

View File

@@ -82,6 +82,32 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu
</tbody>
</table>
### List of Beta Kubernetes Metrics
<table class="table metrics" caption="This is the list of BETA metrics emitted from core Kubernetes components">
<thead>
<tr>
<th class="metric_name">Name</th>
<th class="metric_stability_level">Stability Level</th>
<th class="metric_type">Type</th>
<th class="metric_help">Help</th>
<th class="metric_labels">Labels</th>
<th class="metric_const_labels">Const Labels</th>
<th class="metric_deprecated_version">Deprecated Version</th>
</tr>
</thead>
<tbody>
{{range $index, $metric := .BetaMetrics}}
<tr class="metric"><td class="metric_name">{{with $metric}}{{.BuildFQName}}{{end}}</td>
<td class="metric_stability_level" data-stability="{{$metric.StabilityLevel | ToLower}}">{{$metric.StabilityLevel}}</td>
<td class="metric_type" data-type="{{$metric.Type | ToLower}}">{{$metric.Type}}</td>
<td class="metric_description">{{$metric.Help}}</td>
{{if not $metric.Labels }}<td class="metric_labels_varying"></td>{{else }}<td class="metric_labels_varying">{{range $label := $metric.Labels}}<div class="metric_label">{{$label}}</div>{{end}}</td>{{end}}
{{if not $metric.ConstLabels }}<td class="metric_labels_constant"></td>{{else }}<td class="metric_labels_constant">{{range $key, $value := $metric.ConstLabels}}<div class="metric_label">{{$key}}:{{$value}}</div>{{end}}</td>{{end}}
{{if not $metric.DeprecatedVersion }}<td class="metric_deprecated_version"></td>{{else }}<td class="metric_deprecated_version">{{$metric.DeprecatedVersion}}</td>{{end}}</tr>{{end}}
</tbody>
</table>
### List of Alpha Kubernetes Metrics
<table class="table metrics" caption="This is the list of ALPHA metrics emitted from core Kubernetes components">
@@ -112,6 +138,7 @@ components using an HTTP scrape, and fetch the current metrics data in Prometheu
type templateData struct {
AlphaMetrics []metric
BetaMetrics []metric
StableMetrics []metric
GeneratedDate time.Time
GeneratedVersion string
@@ -122,8 +149,8 @@ func main() {
var minor string
flag.StringVar(&major, "major", "", "k8s major version")
flag.StringVar(&minor, "minor", "", "k8s minor version")
println(major, minor)
flag.Parse()
println(major, minor)
dat, err := os.ReadFile("test/instrumentation/documentation/documentation-list.yaml")
if err == nil {
var parsedMetrics []metric
@@ -146,6 +173,7 @@ func main() {
sortedMetrics := byStabilityLevel(parsedMetrics)
data := templateData{
AlphaMetrics: sortedMetrics["ALPHA"],
BetaMetrics: sortedMetrics["BETA"],
StableMetrics: sortedMetrics["STABLE"],
GeneratedDate: time.Now(),
GeneratedVersion: fmt.Sprintf("%v.%v", major, parseMinor(minor)),