mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Remove unused func and struct from pod.go
This commit is contained in:
parent
ec86baf00b
commit
2eac9a0f17
@ -18,8 +18,6 @@ package metrics
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
e2eperftype "k8s.io/kubernetes/test/e2e/perftype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// LatencyMetric is a struct for dashboard metrics.
|
// LatencyMetric is a struct for dashboard metrics.
|
||||||
@ -29,53 +27,3 @@ type LatencyMetric struct {
|
|||||||
Perc99 time.Duration `json:"Perc99"`
|
Perc99 time.Duration `json:"Perc99"`
|
||||||
Perc100 time.Duration `json:"Perc100"`
|
Perc100 time.Duration `json:"Perc100"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodStartupLatency is a struct for managing latency of pod startup.
|
|
||||||
type PodStartupLatency struct {
|
|
||||||
CreateToScheduleLatency LatencyMetric `json:"createToScheduleLatency"`
|
|
||||||
ScheduleToRunLatency LatencyMetric `json:"scheduleToRunLatency"`
|
|
||||||
RunToWatchLatency LatencyMetric `json:"runToWatchLatency"`
|
|
||||||
ScheduleToWatchLatency LatencyMetric `json:"scheduleToWatchLatency"`
|
|
||||||
E2ELatency LatencyMetric `json:"e2eLatency"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SummaryKind returns the summary of pod startup latency.
|
|
||||||
func (l *PodStartupLatency) SummaryKind() string {
|
|
||||||
return "PodStartupLatency"
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrintHumanReadable returns pod startup letency with JSON format.
|
|
||||||
func (l *PodStartupLatency) PrintHumanReadable() string {
|
|
||||||
return PrettyPrintJSON(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrintJSON returns pod startup letency with JSON format.
|
|
||||||
func (l *PodStartupLatency) PrintJSON() string {
|
|
||||||
return PrettyPrintJSON(PodStartupLatencyToPerfData(l))
|
|
||||||
}
|
|
||||||
|
|
||||||
func latencyToPerfData(l LatencyMetric, name string) e2eperftype.DataItem {
|
|
||||||
return e2eperftype.DataItem{
|
|
||||||
Data: map[string]float64{
|
|
||||||
"Perc50": float64(l.Perc50) / 1000000, // us -> ms
|
|
||||||
"Perc90": float64(l.Perc90) / 1000000,
|
|
||||||
"Perc99": float64(l.Perc99) / 1000000,
|
|
||||||
"Perc100": float64(l.Perc100) / 1000000,
|
|
||||||
},
|
|
||||||
Unit: "ms",
|
|
||||||
Labels: map[string]string{
|
|
||||||
"Metric": name,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PodStartupLatencyToPerfData transforms PodStartupLatency to PerfData.
|
|
||||||
func PodStartupLatencyToPerfData(latency *PodStartupLatency) *e2eperftype.PerfData {
|
|
||||||
perfData := &e2eperftype.PerfData{Version: currentAPICallMetricsVersion}
|
|
||||||
perfData.DataItems = append(perfData.DataItems, latencyToPerfData(latency.CreateToScheduleLatency, "create_to_schedule"))
|
|
||||||
perfData.DataItems = append(perfData.DataItems, latencyToPerfData(latency.ScheduleToRunLatency, "schedule_to_run"))
|
|
||||||
perfData.DataItems = append(perfData.DataItems, latencyToPerfData(latency.RunToWatchLatency, "run_to_watch"))
|
|
||||||
perfData.DataItems = append(perfData.DataItems, latencyToPerfData(latency.ScheduleToWatchLatency, "schedule_to_watch"))
|
|
||||||
perfData.DataItems = append(perfData.DataItems, latencyToPerfData(latency.E2ELatency, "pod_startup"))
|
|
||||||
return perfData
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user