MM-58281 Change performance timestamps to be floats (#27046)

* MM-58281 Change performance timestamps to be floats

* Commit missed line
Этот коммит содержится в:
Harrison Healey
2024-05-17 13:52:03 -04:00
коммит произвёл GitHub
родитель 3e734ee949
Коммит b9f7d38cb1
5 изменённых файлов: 27 добавлений и 27 удалений

Просмотреть файл

@@ -36,7 +36,7 @@ var (
type MetricSample struct {
Metric MetricType `json:"metric"`
Value float64 `json:"value"`
Timestamp int64 `json:"timestamp,omitempty"`
Timestamp float64 `json:"timestamp,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
@@ -45,8 +45,8 @@ type PerformanceReport struct {
Version string `json:"version"`
ClientID string `json:"client_id"`
Labels map[string]string `json:"labels"`
Start int64 `json:"start"`
End int64 `json:"end"`
Start float64 `json:"start"`
End float64 `json:"end"`
Counters []*MetricSample `json:"counters"`
Histograms []*MetricSample `json:"histograms"`
}
@@ -70,8 +70,8 @@ func (r *PerformanceReport) IsValid() error {
}
now := time.Now().UnixMilli()
if r.End < now-performanceReportTTLMilliseconds {
return fmt.Errorf("report is outdated: %d", r.End)
if r.End < float64(now-performanceReportTTLMilliseconds) {
return fmt.Errorf("report is outdated: %f", r.End)
}
return nil