add configuration ForceUseServerTS (#1128)
This commit is contained in:
parent
640b6e6825
commit
3963470603
|
@ -190,6 +190,7 @@ type Config struct {
|
|||
EngineDelay int64
|
||||
DisableUsageReport bool
|
||||
ReaderFrom string
|
||||
ForceUseServerTS bool
|
||||
Log logx.Config
|
||||
HTTP httpx.Config
|
||||
BasicAuth gin.Accounts
|
||||
|
|
|
@ -55,6 +55,16 @@ func (w WriterType) Write(index int, items []*prompb.TimeSeries, headers ...map[
|
|||
}
|
||||
}()
|
||||
|
||||
if config.C.ForceUseServerTS {
|
||||
ts := start.UnixMilli()
|
||||
for i := 0; i < len(items); i++ {
|
||||
if len(items[i].Samples) == 0 {
|
||||
continue
|
||||
}
|
||||
items[i].Samples[0].Timestamp = ts
|
||||
}
|
||||
}
|
||||
|
||||
req := &prompb.WriteRequest{
|
||||
Timeseries: items,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue