From e2264b8c636adfe291c03b2849916a65351c0ab0 Mon Sep 17 00:00:00 2001 From: Idriss Neumann Date: Thu, 23 Nov 2023 10:41:45 +0100 Subject: [PATCH] Issue #12: use the nanoseconds instead --- build_and_start.sh | 1 + pkg/quickwit/client/client.go | 7 +++++++ src/datasource.ts | 5 ++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build_and_start.sh b/build_and_start.sh index efbdaf6..d7c03ec 100755 --- a/build_and_start.sh +++ b/build_and_start.sh @@ -3,4 +3,5 @@ npm install npm run build mage -v +go test -v ./pkg/... docker-compose up --build --force-recreate diff --git a/pkg/quickwit/client/client.go b/pkg/quickwit/client/client.go index f63ee78..8124781 100644 --- a/pkg/quickwit/client/client.go +++ b/pkg/quickwit/client/client.go @@ -166,6 +166,13 @@ func (c *baseClientImpl) ExecuteMultisearch(r *MultiSearchRequest) (*MultiSearch c.logger.Debug("Received multisearch response", "code", res.StatusCode, "status", res.Status, "content-length", res.ContentLength) + if res.StatusCode >= 400 { + jsonResponseBody, _ := json.Marshal(res.Body) + jsonQueryParam, _ := json.Marshal(queryParams) + jsonRequestBody, _ := json.Marshal(r.Requests) + c.logger.Error("Error on multisearch: statusCode = " + strconv.Itoa(res.StatusCode) + ", responseBody = " + string(jsonResponseBody) + ", queryParam = " + string(jsonQueryParam) + ", requestBody = " + string(jsonRequestBody)) + } + start := time.Now() c.logger.Debug("Decoding multisearch json response") diff --git a/src/datasource.ts b/src/datasource.ts index 7478333..36af503 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -434,8 +434,7 @@ export class QuickwitDataSource private makeLogContextDataRequest = (row: LogRowModel, options?: LogRowContextOptions) => { const direction = options?.direction || LogRowContextQueryDirection.Backward; - const searchAfterNs = row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochNs] - const searchAfterMs = [Math.round(searchAfterNs[0]/1000000)] + const searchAfter = row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochNs] const logQuery: Logs = { type: 'logs', @@ -445,7 +444,7 @@ export class QuickwitDataSource // Sorting of results in the context query sortDirection: direction === LogRowContextQueryDirection.Backward ? 'desc' : 'asc', // Used to get the next log lines before/after the current log line using sort field of selected log line - searchAfter: searchAfterMs, + searchAfter: searchAfter, }, };