Make extraction honor ms-precision timestamps.
The test touched by this commit exposed the bug already. Change-Id: I303131eab841ae0ea9b1a727230e68754a4cd8fe
This commit is contained in:
parent
5ae6e57c4c
commit
d0daf681d6
|
@ -85,7 +85,7 @@ func extractCounter(out Ingester, o *ProcessOptions, f *dto.MetricFamily) error
|
|||
samples = append(samples, sample)
|
||||
|
||||
if m.TimestampMs != nil {
|
||||
sample.Timestamp = model.TimestampFromUnix(*m.TimestampMs / 1000)
|
||||
sample.Timestamp = model.TimestampFromUnixNano(*m.TimestampMs * 1000000)
|
||||
} else {
|
||||
sample.Timestamp = o.Timestamp
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ func extractGauge(out Ingester, o *ProcessOptions, f *dto.MetricFamily) error {
|
|||
samples = append(samples, sample)
|
||||
|
||||
if m.TimestampMs != nil {
|
||||
sample.Timestamp = model.TimestampFromUnix(*m.TimestampMs / 1000)
|
||||
sample.Timestamp = model.TimestampFromUnixNano(*m.TimestampMs * 1000000)
|
||||
} else {
|
||||
sample.Timestamp = o.Timestamp
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ func extractSummary(out Ingester, o *ProcessOptions, f *dto.MetricFamily) error
|
|||
|
||||
timestamp := o.Timestamp
|
||||
if m.TimestampMs != nil {
|
||||
timestamp = model.TimestampFromUnix(*m.TimestampMs / 1000)
|
||||
timestamp = model.TimestampFromUnixNano(*m.TimestampMs * 1000000)
|
||||
}
|
||||
|
||||
for _, q := range m.Summary.Quantile {
|
||||
|
@ -209,7 +209,7 @@ func extractUntyped(out Ingester, o *ProcessOptions, f *dto.MetricFamily) error
|
|||
samples = append(samples, sample)
|
||||
|
||||
if m.TimestampMs != nil {
|
||||
sample.Timestamp = model.TimestampFromUnix(*m.TimestampMs / 1000)
|
||||
sample.Timestamp = model.TimestampFromUnixNano(*m.TimestampMs * 1000000)
|
||||
} else {
|
||||
sample.Timestamp = o.Timestamp
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ mf2 4
|
|||
&model.Sample{
|
||||
Metric: model.Metric{model.MetricNameLabel: "mf1", "label": "value1"},
|
||||
Value: -3.14,
|
||||
Timestamp: 123,
|
||||
Timestamp: 123456,
|
||||
},
|
||||
&model.Sample{
|
||||
Metric: model.Metric{model.MetricNameLabel: "mf1", "label": "value2"},
|
||||
|
|
Loading…
Reference in New Issue