Change:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!--What happened: Admission metrics name is and , the units from metrics name are , but actually the return metrics are in . What you expected to happen: Return metrics in true units. How to reproduce it (as minimally and precisely as possible): curl apiserver:8080/metrics Anything else we need to know?: Environment: Kubernetes version (use ): master branch Cloud provider or hardware configuration: OS (e.g. from /etc/os-release): Kernel (e.g. ): Install tools: Others: <!-- DO NOT EDIT BELOW THIS LINE --/kind bug
/assign
/sig api-machinery
/cc
What about these? - -
metrics had been renamed to . And these unit are all fixed to seconds by .

Discussion:
} type metricSet struct { <del> latencies        *prometheus.HistogramVec latenciesSummary *prometheus.SummaryVec </del> <ins> latencies                  *prometheus.HistogramVec deprecatedLatencies        *prometheus.HistogramVec latenciesSummary           *prometheus.SummaryVec deprecatedLatenciesSummary *prometheus.SummaryVec </ins> } func newMetricSet(name string, labels []string, helpTemplate string, hasSummary bool) *metricSet { <del> var summary *prometheus.SummaryVec </del> <ins> var summary, deprecatedSummary *prometheus.SummaryVec </ins> if hasSummary { summary = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: subsystem, Name:      fmt.Sprintf("%s_admission_latencies_seconds_summary", name), <del> Help:      fmt.Sprintf(helpTemplate, "latency summary"), </del> <ins> Help:      fmt.Sprintf(helpTemplate, "latency summary in seconds"), MaxAge:    latencySummaryMaxAge, }, labels, ) deprecatedSummary = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: subsystem, Name:      fmt.Sprintf("%s_admission_latencies_milliseconds_summary", name), Help:      fmt.Sprintf("(Deprecated) "+helpTemplate, "latency summary in milliseconds"), </ins> MaxAge:    latencySummaryMaxAge, }, labels,

Namespace: namespace, Subsystem: subsystem, Name:      fmt.Sprintf("%s_admission_latencies_seconds", name), <del> Help:      fmt.Sprintf(helpTemplate, "latency histogram"), </del> <ins> Help:      fmt.Sprintf(helpTemplate, "latency histogram in seconds"), Buckets:   latencyBuckets, }, labels, ), deprecatedLatencies: prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name:      fmt.Sprintf("%s_admission_latencies_milliseconds", name), Help:      fmt.Sprintf("(Deprecated) "+helpTemplate, "latency histogram in milliseconds"), </ins> Buckets:   latencyBuckets, }, labels, ), <del> latenciesSummary: summary, </del> <ins> latenciesSummary:           summary, deprecatedLatenciesSummary: deprecatedSummary, </ins> } } // MustRegister registers all the prometheus metrics in the metricSet. func (m *metricSet) mustRegister() { prometheus.MustRegister(m.latencies) <ins> prometheus.MustRegister(m.deprecatedLatencies) </ins> if m.latenciesSummary != nil { prometheus.MustRegister(m.latenciesSummary) } <ins> if m.deprecatedLatenciesSummary != nil { prometheus.MustRegister(m.deprecatedLatenciesSummary) } </ins> } // Reset resets all the prometheus metrics in the metricSet. func (m *metricSet) reset() { m.latencies.Reset() <ins> m.deprecatedLatencies.Reset() </ins> if m.latenciesSummary != nil { m.latenciesSummary.Reset() } <ins> if m.deprecatedLatenciesSummary != nil { m.deprecatedLatenciesSummary.Reset() } </ins> } // Observe records an observed admission event to all metrics in the metricSet. func (m *metricSet) observe(elapsed time.Duration, labels ...string) { <ins> elapsedSeconds := elapsed.Seconds() </ins> elapsedMicroseconds := float64(elapsed / time.Microsecond) <del> m.latencies.WithLabelValues(labels...).Observe(elapsedMicroseconds) </del> <ins> m.latencies.WithLabelValues(labels...).Observe(elapsedSeconds) m.deprecatedLatencies.WithLabelValues(labels...).Observe(elapsedMicroseconds) </ins> if m.latenciesSummary != nil { <del> m.latenciesSummary.WithLabelValues(labels...).Observe(elapsedMicroseconds) </del> <ins> m.latenciesSummary.WithLabelValues(labels...).Observe(elapsedSeconds) } if m.deprecatedLatenciesSummary != nil { m.deprecatedLatenciesSummary.WithLabelValues(labels...).Observe(elapsedMicroseconds) </ins> } }