type MetricRecorder … var _ … type PendingPodsRecorder … // NewActivePodsRecorder returns ActivePods in a Prometheus metric fashion func NewActivePodsRecorder() *PendingPodsRecorder { … } // NewUnschedulablePodsRecorder returns UnschedulablePods in a Prometheus metric fashion func NewUnschedulablePodsRecorder() *PendingPodsRecorder { … } // NewBackoffPodsRecorder returns BackoffPods in a Prometheus metric fashion func NewBackoffPodsRecorder() *PendingPodsRecorder { … } // NewGatedPodsRecorder returns GatedPods in a Prometheus metric fashion func NewGatedPodsRecorder() *PendingPodsRecorder { … } // Inc increases a metric counter by 1, in an atomic way func (r *PendingPodsRecorder) Inc() { … } // Dec decreases a metric counter by 1, in an atomic way func (r *PendingPodsRecorder) Dec() { … } // Clear set a metric counter to 0, in an atomic way func (r *PendingPodsRecorder) Clear() { … } type histogramVecMetric … type gaugeVecMetric … type gaugeVecMetricKey … type MetricAsyncRecorder … func NewMetricsAsyncRecorder(bufferSize int, interval time.Duration, stopCh <-chan struct{ … } // ObservePluginDurationAsync observes the plugin_execution_duration_seconds metric. // The metric will be flushed to Prometheus asynchronously. func (r *MetricAsyncRecorder) ObservePluginDurationAsync(extensionPoint, pluginName, status string, value float64) { … } // ObserveQueueingHintDurationAsync observes the queueing_hint_execution_duration_seconds metric. // The metric will be flushed to Prometheus asynchronously. func (r *MetricAsyncRecorder) ObserveQueueingHintDurationAsync(pluginName, event, hint string, value float64) { … } // ObserveInFlightEventsAsync observes the in_flight_events metric. // // Note that this function is not goroutine-safe; // we don't lock the map deliberately for the performance reason and we assume the queue (i.e., the caller) takes lock before updating the in-flight events. func (r *MetricAsyncRecorder) ObserveInFlightEventsAsync(eventLabel string, valueToAdd float64, forceFlush bool) { … } func (r *MetricAsyncRecorder) observeMetricAsync(m *metrics.HistogramVec, value float64, labelsValues ...string) { … } // run flushes buffered metrics into Prometheus every second. func (r *MetricAsyncRecorder) run() { … } // FlushMetrics tries to clean up the bufferCh by reading at most bufferSize metrics. func (r *MetricAsyncRecorder) FlushMetrics() { … }