github.com/eth-easl/loader@v0.0.0-20230908084258-8a37e1d94279/pkg/metric/record.go (about) 1 /* 2 * MIT License 3 * 4 * Copyright (c) 2023 EASL and the vHive community 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 25 package metric 26 27 type StartType string 28 29 const ( 30 Hot StartType = "hot" 31 Cold StartType = "cold" 32 ) 33 34 type MinuteInvocationRecord struct { 35 Phase int `csv:"phase"` 36 Rps int `csv:"rps"` 37 MinuteIdx int `csv:"index"` 38 Duration int64 `csv:"duration"` 39 NumFuncTargeted int `csv:"num_func_target"` 40 NumFuncInvoked int `csv:"num_func_invoked"` 41 NumColdStarts int `csv:"num_coldstarts"` 42 } 43 44 type ExecutionRecordBase struct { 45 Phase int `csv:"phase"` 46 Instance string `csv:"instance"` 47 InvocationID string `csv:"invocationID"` 48 StartTime int64 `csv:"startTime"` 49 50 // Measurements in microseconds 51 RequestedDuration uint32 `csv:"requestedDuration"` 52 ResponseTime int64 `csv:"responseTime"` 53 ActualDuration uint32 `csv:"actualDuration"` 54 55 ConnectionTimeout bool `csv:"connectionTimeout"` 56 FunctionTimeout bool `csv:"functionTimeout"` 57 } 58 59 type ExecutionRecordOpenWhisk struct { 60 ExecutionRecordBase 61 62 ActivationID string `csv:"activationID"` 63 StartType StartType `csv:"startType"` 64 HttpStatusCode int `csv:"httpStatusCode"` 65 66 // Measurements in microseconds 67 WaitTime int64 `csv:"waitTime"` 68 InitTime int64 `csv:"initTime"` 69 } 70 71 type ExecutionRecord struct { 72 ExecutionRecordBase 73 74 // Measurements in microseconds 75 ActualMemoryUsage uint32 `csv:"actualMemoryUsage"` 76 77 MemoryAllocationTimeout bool `csv:"memoryAllocationTimeout"` 78 79 // TODO: EVERYTHING BELOW ARE UNTESTED FIELDS 80 81 //* In KiB 82 /*Memory uint32 `csv:"memory"` 83 MemoryLoad float64 `csv:"mem_load"` 84 Interval int64 `csv:"interval"` 85 86 //* Infra statistics are all in percentages. 87 MasterCpu float64 `csv:"master_cpu"` 88 MasterMem float64 `csv:"master_mem"` 89 WorkerCpuAvg float64 `csv:"worker_cpu_avg"` 90 WorkerCpuMax float64 `csv:"worker_cpu_max"` 91 WorkerCpuActiveAvg float64 `csv:"worker_cpu_active_avg"` 92 WorkerMemAvg float64 `csv:"worker_mem"` 93 94 DesiredPods int `csv:"desired_pods"` 95 UnreadyPods int `csv:"unready_pods"` 96 PendingPods int `csv:"pending_pods"` 97 RequestedPods int `csv:"requested_pods"` 98 RunningPods int `csv:"running_pods"` 99 100 ActivatorQueue float64 `csv:"activator_queue"` 101 ActivatorRequestCount int `csv:"activator_request_count"` 102 AutoscalerStableQueue float64 `csv:"autoscaler_stable_queue"` 103 AutoscalerPanicQueue float64 `csv:"autoscaler_panic_queue"` 104 105 SchedulingP99 float64 `csv:"scheduling_p99"` 106 SchedulingP50 float64 `csv:"scheduling_p50"` 107 E2ePlacementP99 float64 `csv:"e2e_placement_p99"` 108 E2ePlacementP50 float64 `csv:"e2e_placement_p50"` 109 110 ColdStartCount int `csv:"coldstart_count"`*/ 111 } 112 113 type DeploymentScale struct { 114 Timestamp int64 `csv:"timestamp" json:"timestamp"` 115 Function string `csv:"function" json:"function"` 116 DesiredPods int `csv:"desired_pods" json:"desired_pods"` 117 RunningPods int `csv:"running_pods" json:"running_pods"` 118 UnreadyPods int `csv:"unready_pods" json:"unready_pods"` 119 PendingPods int `csv:"pending_pods" json:"pending_pods"` 120 TerminatingPods int `csv:"terminating_pods" json:"terminating_pods"` 121 ActivatorQueue float64 `csv:"activator_queue" json:"activator_queue"` 122 } 123 124 type KnStats struct { 125 Timestamp int64 `csv:"timestamp" json:"timestamp"` 126 127 DesiredPods int `csv:"desired_pods" json:"desired_pods"` 128 UnreadyPods int `csv:"unready_pods" json:"unready_pods"` 129 PendingPods int `csv:"pending_pods" json:"pending_pods"` 130 RequestedPods int `csv:"requested_pods" json:"requested_pods"` 131 RunningPods int `csv:"running_pods" json:"running_pods"` 132 133 ActivatorQueue float64 `csv:"activator_queue" json:"activator_queue"` 134 ActivatorRequestCount int `csv:"activator_request_count" json:"activator_request_count"` 135 AutoscalerStableQueue float64 `csv:"autoscaler_stable_queue" json:"autoscaler_stable_queue"` 136 AutoscalerPanicQueue float64 `csv:"autoscaler_panic_queue" json:"autoscaler_panic_queue"` 137 138 SchedulingP95 float64 `csv:"scheduling_p95" json:"scheduling_p95"` 139 SchedulingP50 float64 `csv:"scheduling_p50" json:"scheduling_p50"` 140 E2ePlacementP95 float64 `csv:"e2e_placement_p95" json:"e2e_placement_p95"` 141 E2ePlacementP50 float64 `csv:"e2e_placement_p50" json:"e2e_placement_p50"` 142 } 143 144 type ClusterUsage struct { 145 Timestamp int64 `csv:"timestamp" json:"timestamp"` 146 MasterCpuPct float64 `csv:"master_cpu_pct" json:"master_cpu_pct"` 147 MasterCpuReq float64 `csv:"master_cpu_req" json:"master_cpu_req"` 148 MasterCpuLim float64 `csv:"master_cpu_lim" json:"master_cpu_lim"` 149 MasterMemoryPct float64 `csv:"master_mem_pct" json:"master_mem_pct"` 150 MasterMemoryReq float64 `csv:"master_mem_req" json:"master_mem_req"` 151 MasterMemoryLim float64 `csv:"master_mem_lim" json:"master_mem_lim"` 152 MasterPods int `csv:"master_pods" json:"master_pods"` 153 Cpu []string `csv:"cpu" json:"cpu"` 154 CpuReq []float64 `csv:"cpu_req" json:"cpu_req"` 155 CpuLim []float64 `csv:"cpu_lim" json:"cpu_lim"` 156 CpuPctAvg float64 `csv:"cpu_pct_avg" json:"cpu_pct_avg"` 157 CpuPctMax float64 `csv:"cpu_pct_max" json:"cpu_pct_max"` 158 CpuPctActiveAvg float64 `csv:"cpu_pct_active_avg" json:"cpu_pct_active_avg"` 159 Memory []string `csv:"memory" json:"memory"` 160 MemoryReq []float64 `csv:"memory_req" json:"memory_req"` 161 MemoryLim []float64 `csv:"memory_lim" json:"memory_lim"` 162 MemoryPctAvg float64 `csv:"memory_pct" json:"memory_pct"` 163 PodCpu []string `csv:"pod_cpu" json:"pod_cpu"` 164 PodMemory []string `csv:"pod_memory" json:"pod_mem"` 165 Pods []int `csv:"pods" json:"pods"` 166 LoaderCpu float64 `csv:"loader_cpu" json:"loader_cpu"` 167 LoaderMem float64 `csv:"loader_mem" json:"loader_mem"` 168 } 169 170 type AdfResult struct { 171 TestStats float64 `json:"statistic"` 172 Pvalue float64 `json:"pvalue"` 173 Lag int `json:"usedlag"` 174 NumObs int `json:"nobs"` 175 CriticalVals TValues `json:"critical_vals"` 176 IcBest float64 `json:"icbest"` 177 } 178 179 type TValues struct { 180 Pct1 float64 `json:"1%"` 181 Pct5 float64 `json:"5%"` 182 Pct10 float64 `json:"10%"` 183 }