update capabilities of static analysis parser

Change-Id: Ie09399981fcef213e0e7c7d12a8039aedbf0246a
This commit is contained in:
Han Kang
2022-09-27 16:23:18 -07:00
parent dfc9bf0953
commit 521a027fea
8 changed files with 180 additions and 70 deletions

View File

@@ -45,9 +45,9 @@ type StableCollector interface {
HiddenMetrics() []string
}
// BaseStableCollector which implements almost all of the methods defined by StableCollector
// BaseStableCollector which implements almost all methods defined by StableCollector
// is a convenient assistant for custom collectors.
// It is recommend that inherit BaseStableCollector when implementing custom collectors.
// It is recommended to inherit BaseStableCollector when implementing custom collectors.
type BaseStableCollector struct {
descriptors map[string]*Desc // stores all descriptors by pair<fqName, Desc>, these are collected from DescribeWithStability().
registerable map[string]*Desc // stores registerable descriptors by pair<fqName, Desc>, is a subset of descriptors.
@@ -62,7 +62,7 @@ func (bsc *BaseStableCollector) DescribeWithStability(ch chan<- *Desc) {
}
// Describe sends all descriptors to the provided channel.
// It intend to be called by prometheus registry.
// It intended to be called by prometheus registry.
func (bsc *BaseStableCollector) Describe(ch chan<- *prometheus.Desc) {
for _, d := range bsc.registerable {
ch <- d.toPrometheusDesc()

View File

@@ -66,9 +66,15 @@ func BuildFQName(namespace, subsystem, name string) string {
type StabilityLevel string
const (
// INTERNAL metrics have no stability guarantees, as such, labels may
// be arbitrarily added/removed and the metric may be deleted at any time.
INTERNAL StabilityLevel = "INTERNAL"
// ALPHA metrics have no stability guarantees, as such, labels may
// be arbitrarily added/removed and the metric may be deleted at any time.
ALPHA StabilityLevel = "ALPHA"
// BETA metrics are governed by the deprecation policy outlined in by
// the control plane metrics stability KEP.
BETA StabilityLevel = "BETA"
// STABLE metrics are guaranteed not be mutated and removal is governed by
// the deprecation policy outlined in by the control plane metrics stability KEP.
STABLE StabilityLevel = "STABLE"

View File

@@ -38,9 +38,9 @@ func TestDefaultStabilityLevel(t *testing.T) {
expectPanic: false,
},
{
name: "ALPHA remain unchanged",
inputValue: ALPHA,
expectValue: ALPHA,
name: "INTERNAL remain unchanged",
inputValue: INTERNAL,
expectValue: INTERNAL,
expectPanic: false,
},
{