type Desc … // NewDesc extends prometheus.NewDesc with stability support. // // The stabilityLevel should be valid stability label, such as "metrics.ALPHA" // and "metrics.STABLE"(Maybe "metrics.BETA" in future). Default value "metrics.ALPHA" // will be used in case of empty or invalid stability label. // // The deprecatedVersion represents in which version this Metric be deprecated. // The deprecation policy outlined by the control plane metrics stability KEP. func NewDesc(fqName string, help string, variableLabels []string, constLabels Labels, stabilityLevel StabilityLevel, deprecatedVersion string) *Desc { … } // String formats the Desc as a string. // The stability metadata maybe annotated in 'HELP' section if called after registry, // otherwise not. // e.g. "Desc{fqName: "normal_stable_descriptor", help: "[STABLE] this is a stable descriptor", constLabels: {}, variableLabels: []}" func (d *Desc) String() string { … } // toPrometheusDesc transform self to prometheus.Desc func (d *Desc) toPrometheusDesc() *prometheus.Desc { … } // DeprecatedVersion returns a pointer to the Version or nil func (d *Desc) DeprecatedVersion() *semver.Version { … } func (d *Desc) determineDeprecationStatus(version semver.Version) { … } // IsHidden returns if metric will be hidden func (d *Desc) IsHidden() bool { … } // IsDeprecated returns if metric has been deprecated func (d *Desc) IsDeprecated() bool { … } // IsCreated returns if metric has been created. func (d *Desc) IsCreated() bool { … } // create forces the initialization of Desc which has been deferred until // the point at which this method is invoked. This method will determine whether // the Desc is deprecated or hidden, no-opting if the Desc should be considered // hidden. Furthermore, this function no-opts and returns true if Desc is already // created. func (d *Desc) create(version *semver.Version) bool { … } // ClearState will clear all the states marked by Create. // It intends to be used for re-register a hidden metric. func (d *Desc) ClearState() { … } func (d *Desc) markDeprecated() { … } func (d *Desc) annotateStabilityLevel() { … } func (d *Desc) initialize() { … } func (d *Desc) initializeDeprecatedDesc() { … } // GetRawDesc will returns a new *Desc with original parameters provided to NewDesc(). // // It will be useful in testing scenario that the same Desc be registered to different registry. // 1. Desc `D` is registered to registry 'A' in TestA (Note: `D` maybe created) // 2. Desc `D` is registered to registry 'B' in TestB (Note: since 'D' has been created once, thus will be ignored by registry 'B') func (d *Desc) GetRawDesc() *Desc { … }