MCPcopy
hub / github.com/grpc/grpc-go / merge

Method merge

orca/server_metrics.go:69–88  ·  view source on GitHub ↗

merge merges o into sm, overwriting any values present in both.

(o *ServerMetrics)

Source from the content-addressed store, hash-verified

67
68// merge merges o into sm, overwriting any values present in both.
69func (sm *ServerMetrics) merge(o *ServerMetrics) {
70 mergeMap(sm.Utilization, o.Utilization)
71 mergeMap(sm.RequestCost, o.RequestCost)
72 mergeMap(sm.NamedMetrics, o.NamedMetrics)
73 if o.CPUUtilization != -1 {
74 sm.CPUUtilization = o.CPUUtilization
75 }
76 if o.MemUtilization != -1 {
77 sm.MemUtilization = o.MemUtilization
78 }
79 if o.AppUtilization != -1 {
80 sm.AppUtilization = o.AppUtilization
81 }
82 if o.QPS != -1 {
83 sm.QPS = o.QPS
84 }
85 if o.EPS != -1 {
86 sm.EPS = o.EPS
87 }
88}
89
90func mergeMap(a, b map[string]float64) {
91 for k, v := range b {

Callers 2

setTrailerMetadataMethod · 0.95

Calls 1

mergeMapFunction · 0.85

Tested by 1