mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
fix
Signed-off-by: komisan19 <18901496+komisan19@users.noreply.github.com>
This commit is contained in:
parent
3d84d4d6dc
commit
b974a99279
|
@ -415,36 +415,32 @@ func mostRecentTimestampInMetric(metric pmetric.Metric) pcommon.Timestamp {
|
|||
case pmetric.MetricTypeGauge:
|
||||
dataPoints := metric.Gauge().DataPoints()
|
||||
for x := 0; x < dataPoints.Len(); x++ {
|
||||
ts = maxTimestamp(ts, dataPoints.At(x).Timestamp())
|
||||
ts = max(ts, dataPoints.At(x).Timestamp())
|
||||
}
|
||||
case pmetric.MetricTypeSum:
|
||||
dataPoints := metric.Sum().DataPoints()
|
||||
for x := 0; x < dataPoints.Len(); x++ {
|
||||
ts = maxTimestamp(ts, dataPoints.At(x).Timestamp())
|
||||
ts = max(ts, dataPoints.At(x).Timestamp())
|
||||
}
|
||||
case pmetric.MetricTypeHistogram:
|
||||
dataPoints := metric.Histogram().DataPoints()
|
||||
for x := 0; x < dataPoints.Len(); x++ {
|
||||
ts = maxTimestamp(ts, dataPoints.At(x).Timestamp())
|
||||
ts = max(ts, dataPoints.At(x).Timestamp())
|
||||
}
|
||||
case pmetric.MetricTypeExponentialHistogram:
|
||||
dataPoints := metric.ExponentialHistogram().DataPoints()
|
||||
for x := 0; x < dataPoints.Len(); x++ {
|
||||
ts = maxTimestamp(ts, dataPoints.At(x).Timestamp())
|
||||
ts = max(ts, dataPoints.At(x).Timestamp())
|
||||
}
|
||||
case pmetric.MetricTypeSummary:
|
||||
dataPoints := metric.Summary().DataPoints()
|
||||
for x := 0; x < dataPoints.Len(); x++ {
|
||||
ts = maxTimestamp(ts, dataPoints.At(x).Timestamp())
|
||||
ts = max(ts, dataPoints.At(x).Timestamp())
|
||||
}
|
||||
}
|
||||
return ts
|
||||
}
|
||||
|
||||
func maxTimestamp(a, b pcommon.Timestamp) pcommon.Timestamp {
|
||||
return max(a, b)
|
||||
}
|
||||
|
||||
// addSingleSummaryDataPoint converts pt to len(QuantileValues) + 2 samples.
|
||||
func addSingleSummaryDataPoint(pt pmetric.SummaryDataPoint, resource pcommon.Resource, metric pmetric.Metric, settings Settings,
|
||||
tsMap map[string]*prompb.TimeSeries, baseName string) {
|
||||
|
|
|
@ -45,7 +45,7 @@ func FromMetrics(md pmetric.Metrics, settings Settings) (tsMap map[string]*promp
|
|||
// TODO: decide if instrumentation library information should be exported as labels
|
||||
for k := 0; k < metricSlice.Len(); k++ {
|
||||
metric := metricSlice.At(k)
|
||||
mostRecentTimestamp = maxTimestamp(mostRecentTimestamp, mostRecentTimestampInMetric(metric))
|
||||
mostRecentTimestamp = max(mostRecentTimestamp, mostRecentTimestampInMetric(metric))
|
||||
|
||||
if !isValidAggregationTemporality(metric) {
|
||||
errs = multierr.Append(errs, fmt.Errorf("invalid temporality and type combination for metric %q", metric.Name()))
|
||||
|
|
Loading…
Reference in a new issue