in extension/agenthealth/handler/stats/agent/agent.go [38:104]
func (s *Stats) Merge(other Stats) {
if other.CPUPercent != nil {
s.CPUPercent = other.CPUPercent
}
if other.MemoryBytes != nil {
s.MemoryBytes = other.MemoryBytes
}
if other.FileDescriptorCount != nil {
s.FileDescriptorCount = other.FileDescriptorCount
}
if other.ThreadCount != nil {
s.ThreadCount = other.ThreadCount
}
if other.LatencyMillis != nil {
s.LatencyMillis = other.LatencyMillis
}
if other.PayloadBytes != nil {
s.PayloadBytes = other.PayloadBytes
}
if other.StatusCode != nil {
s.StatusCode = other.StatusCode
}
if other.SharedConfigFallback != nil {
s.SharedConfigFallback = other.SharedConfigFallback
}
if other.ImdsFallbackSucceed != nil {
s.ImdsFallbackSucceed = other.ImdsFallbackSucceed
}
if other.AppSignals != nil {
s.AppSignals = other.AppSignals
}
if other.EnhancedContainerInsights != nil {
s.EnhancedContainerInsights = other.EnhancedContainerInsights
}
if other.RunningInContainer != nil {
s.RunningInContainer = other.RunningInContainer
}
if other.RegionType != nil {
s.RegionType = other.RegionType
}
if other.Mode != nil {
s.Mode = other.Mode
}
if other.EntityRejected != nil {
s.EntityRejected = other.EntityRejected
}
if other.StatusCodes != nil {
if s.StatusCodes == nil {
s.StatusCodes = make(map[string][5]int)
}
for key, value := range other.StatusCodes {
if existing, ok := s.StatusCodes[key]; ok {
s.StatusCodes[key] = [5]int{
existing[0] + value[0], // 200
existing[1] + value[1], // 400
existing[2] + value[2], // 408
existing[3] + value[3], // 413
existing[4] + value[4], // 429
}
} else {
s.StatusCodes[key] = value
}
}
}
}