This repository was archived by the owner on Aug 13, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ import (
2828 "github.com/go-kit/kit/log/level"
2929 "github.com/pkg/errors"
3030 "github.com/prometheus/client_golang/prometheus"
31- "github.com/prometheus/prometheus/pkg/timestamp"
3231 "github.com/prometheus/tsdb/fileutil"
3332 "github.com/prometheus/tsdb/record"
3433)
7978 )
8079)
8180
81+ // This function is copied from prometheus/prometheus/pkg/timestamp to avoid adding vendor to TSDB repo.
82+
83+ // FromTime returns a new millisecond timestamp from a time.
84+ func FromTime (t time.Time ) int64 {
85+ return t .Unix ()* 1000 + int64 (t .Nanosecond ())/ int64 (time .Millisecond )
86+ }
87+
8288func init () {
8389 prometheus .MustRegister (watcherRecordsRead )
8490 prometheus .MustRegister (watcherRecordDecodeFails )
@@ -169,7 +175,7 @@ func (w *WALWatcher) loop() {
169175
170176 // We may encourter failures processing the WAL; we should wait and retry.
171177 for ! isClosed (w .quit ) {
172- w .startTime = timestamp . FromTime (time .Now ())
178+ w .startTime = FromTime (time .Now ())
173179 if err := w .run (); err != nil {
174180 level .Error (w .logger ).Log ("msg" , "error tailing WAL" , "err" , err )
175181 }
You can’t perform that action at this time.
0 commit comments