Skip to content

Commit

Permalink
Set duration unit to nanosecond (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahmily authored Jun 28, 2024
1 parent 3a81f77 commit d64eeb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion banyand/internal/storage/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ func (sc *segmentController[T, O]) removeSeg(segID segmentID) {
for i, b := range sc.lst {
if b.id == segID {
sc.lst = append(sc.lst[:i], sc.lst[i+1:]...)
sc.deadline.Store(sc.lst[0].Start.UnixNano())
if len(sc.lst) < 1 {
sc.deadline.Store(0)
} else {
sc.deadline.Store(sc.lst[0].Start.UnixNano())
}
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ func (s *Span) Error(err error) *Span {
// Stop stops the span.
func (s *Span) Stop() {
s.data.EndTime = timestamppb.Now()
s.data.Duration = s.data.EndTime.AsTime().Sub(s.data.StartTime.AsTime()).Milliseconds()
s.data.Duration = s.data.EndTime.AsTime().Sub(s.data.StartTime.AsTime()).Nanoseconds()
}

0 comments on commit d64eeb6

Please sign in to comment.