Skip to content

Commit 947f50f

Browse files
committed
Remove dead code: unused MetricSummary fields and calculateMin/calculateMax functions
- Remove Min, Max, Avg fields from MetricSummary struct (never read, displayMetric recalculates stats from Data) - Remove dead calculateStats call and field assignments in GetMetricSummary - Remove unused calculateMin and calculateMax helper functions
1 parent f28251c commit 947f50f

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

internal/monitoring/helpers.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,36 +110,6 @@ func getDiskDevice(diskDevice string) string {
110110
return diskDevice
111111
}
112112

113-
// calculateMin returns the minimum value in a slice
114-
func calculateMin(data []float64) float64 {
115-
data = sanitizeFloatSeries(data)
116-
if len(data) == 0 {
117-
return 0
118-
}
119-
min := data[0]
120-
for _, v := range data {
121-
if v < min {
122-
min = v
123-
}
124-
}
125-
return min
126-
}
127-
128-
// calculateMax returns the maximum value in a slice
129-
func calculateMax(data []float64) float64 {
130-
data = sanitizeFloatSeries(data)
131-
if len(data) == 0 {
132-
return 0
133-
}
134-
max := data[0]
135-
for _, v := range data {
136-
if v > max {
137-
max = v
138-
}
139-
}
140-
return max
141-
}
142-
143113
// calculateStats computes min, max, and average of a slice of floats
144114
func calculateStats(data []float64) (min, max, avg float64) {
145115
data = sanitizeFloatSeries(data)

internal/monitoring/metrics.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ type MetricDataPoint struct {
4343
type MetricSummary struct {
4444
Name string
4545
Data []float64
46-
Min float64
47-
Max float64
48-
Avg float64
4946
Unit string
5047
Source string // "AWS" or "Custom"
5148
}
@@ -357,14 +354,9 @@ func (mc *MetricsCollector) GetMetricSummary(metricName, namespace string, aggre
357354
return nil
358355
}
359356

360-
min, max, avg := calculateStats(values)
361-
362357
summary := &MetricSummary{
363358
Name: metricName,
364359
Data: values,
365-
Min: min,
366-
Max: max,
367-
Avg: avg,
368360
}
369361

370362
// Cache the result

0 commit comments

Comments
 (0)