var showHiddenOnce … var disabledMetricsLock … var showHidden … var registries … var registriesLock … var disabledMetrics … var registeredMetricsTotal … var disabledMetricsTotal … var hiddenMetricsTotal … var cardinalityEnforcementUnexpectedCategorizationsTotal … // shouldHide be used to check if a specific metric with deprecated version should be hidden // according to metrics deprecation lifecycle. func shouldHide(currentVersion *semver.Version, deprecatedVersion *semver.Version) bool { … } // ValidateShowHiddenMetricsVersion checks invalid version for which show hidden metrics. func ValidateShowHiddenMetricsVersion(v string) []error { … } func SetDisabledMetric(name string) { … } // SetShowHidden will enable showing hidden metrics. This will no-opt // after the initial call func SetShowHidden() { … } // ShouldShowHidden returns whether showing hidden deprecated metrics // is enabled. While the primary usecase for this is internal (to determine // registration behavior) this can also be used to introspect func ShouldShowHidden() bool { … } type Registerable … type resettable … type KubeRegistry … type kubeRegistry … // Register registers a new Collector to be included in metrics // collection. It returns an error if the descriptors provided by the // Collector are invalid or if they — in combination with descriptors of // already registered Collectors — do not fulfill the consistency and // uniqueness criteria described in the documentation of metric.Desc. func (kr *kubeRegistry) Register(c Registerable) error { … } // Registerer exposes the underlying prometheus.Registerer func (kr *kubeRegistry) Registerer() prometheus.Registerer { … } // Gatherer exposes the underlying prometheus.Gatherer func (kr *kubeRegistry) Gatherer() prometheus.Gatherer { … } // MustRegister works like Register but registers any number of // Collectors and panics upon the first registration that causes an // error. func (kr *kubeRegistry) MustRegister(cs ...Registerable) { … } // CustomRegister registers a new custom collector. func (kr *kubeRegistry) CustomRegister(c StableCollector) error { … } // CustomMustRegister works like CustomRegister but registers any number of // StableCollectors and panics upon the first registration that causes an // error. func (kr *kubeRegistry) CustomMustRegister(cs ...StableCollector) { … } // RawMustRegister takes a native prometheus.Collector and registers the collector // to the registry. This bypasses metrics safety checks, so should only be used // to register custom prometheus collectors. // // Deprecated func (kr *kubeRegistry) RawMustRegister(cs ...prometheus.Collector) { … } // addResettable will automatically add our metric to our reset // list if it satisfies the interface func (kr *kubeRegistry) addResettable(i interface{ … } // Unregister unregisters the Collector that equals the Collector passed // in as an argument. (Two Collectors are considered equal if their // Describe method yields the same set of descriptors.) The function // returns whether a Collector was unregistered. Note that an unchecked // Collector cannot be unregistered (as its Describe method does not // yield any descriptor). func (kr *kubeRegistry) Unregister(collector Collector) bool { … } // Gather calls the Collect method of the registered Collectors and then // gathers the collected metrics into a lexicographically sorted slice // of uniquely named MetricFamily protobufs. Gather ensures that the // returned slice is valid and self-consistent so that it can be used // for valid exposition. As an exception to the strict consistency // requirements described for metric.Desc, Gather will tolerate // different sets of label names for metrics of the same metric family. func (kr *kubeRegistry) Gather() ([]*dto.MetricFamily, error) { … } // trackHiddenCollector stores all hidden collectors. func (kr *kubeRegistry) trackHiddenCollector(c Registerable) { … } // trackStableCollectors stores all custom collectors. func (kr *kubeRegistry) trackStableCollectors(cs ...StableCollector) { … } // enableHiddenCollectors will re-register all of the hidden collectors. func (kr *kubeRegistry) enableHiddenCollectors() { … } // enableHiddenStableCollectors will re-register the stable collectors if there is one or more hidden metrics in it. // Since we can not register a metrics twice, so we have to unregister first then register again. func (kr *kubeRegistry) enableHiddenStableCollectors() { … } // Reset invokes Reset on all metrics that are resettable. func (kr *kubeRegistry) Reset() { … } var BuildVersion … func newKubeRegistry(v apimachineryversion.Info) *kubeRegistry { … } // NewKubeRegistry creates a new vanilla Registry func NewKubeRegistry() KubeRegistry { … } func (r *kubeRegistry) RegisterMetaMetrics() { … }