From b51ff81803c41823ea7981fec4a3e685c1339827 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Thu, 28 Mar 2024 13:51:49 -0700 Subject: [PATCH] fix span to log Signed-off-by: Callum Styan --- pkg/querier/queryrange/codec.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/querier/queryrange/codec.go b/pkg/querier/queryrange/codec.go index 397546cfaf98f..16583f4faeeae 100644 --- a/pkg/querier/queryrange/codec.go +++ b/pkg/querier/queryrange/codec.go @@ -83,8 +83,8 @@ func (r *LokiRequest) WithShards(shards logql.Shards) *LokiRequest { func (r *LokiRequest) LogToSpan(sp opentracing.Span) { sp.LogFields( otlog.String("query", r.GetQuery()), - otlog.String("start", timestamp.Time(r.GetStart().UnixNano()).String()), - otlog.String("end", timestamp.Time(r.GetEnd().UnixNano()).String()), + otlog.String("start", timestamp.Time(r.StartTs.UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), + otlog.String("end", timestamp.Time(r.GetEnd().UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), otlog.Int64("step (ms)", r.GetStep()), otlog.Int64("interval (ms)", r.GetInterval()), otlog.Int64("limit", int64(r.GetLimit())), @@ -178,8 +178,8 @@ func (r *LokiSeriesRequest) GetStep() int64 { func (r *LokiSeriesRequest) LogToSpan(sp opentracing.Span) { sp.LogFields( otlog.String("matchers", strings.Join(r.GetMatch(), ",")), - otlog.String("start", timestamp.Time(r.GetStart().UnixNano()).String()), - otlog.String("end", timestamp.Time(r.GetEnd().UnixNano()).String()), + otlog.String("start", timestamp.Time(r.GetStart().UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), + otlog.String("end", timestamp.Time(r.GetEnd().UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), otlog.String("shards", strings.Join(r.GetShards(), ",")), ) } @@ -249,8 +249,8 @@ func (r *LabelRequest) WithQuery(query string) queryrangebase.Request { func (r *LabelRequest) LogToSpan(sp opentracing.Span) { sp.LogFields( - otlog.String("start", timestamp.Time(r.GetStart().UnixNano()).String()), - otlog.String("end", timestamp.Time(r.GetEnd().UnixNano()).String()), + otlog.String("start", timestamp.Time(r.Start.UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), + otlog.String("end", timestamp.Time(r.End.UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond))).String()), ) }