Skip to content

Commit

Permalink
small fixes (prepare for framing)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryk-dk committed Feb 8, 2024
1 parent bd726c6 commit 7e637a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ app-via-docker-windows-amd64:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(MAKE) app-via-docker-windows-goarch

victorialogs-backend-plugin-build: \
victorialogs-backend-plugin-amd64-prod
# victorialogs-backend-plugin-linux-amd64-prod \
# victorialogs-backend-plugin-linux-arm-prod \
# victorialogs-backend-plugin-linux-arm64-prod \
# victorialogs-backend-plugin-linux-386-prod \
# victorialogs-backend-plugin-arm64-prod \
# victorialogs-backend-plugin-windows-prod
victorialogs-backend-plugin-amd64-prod \
victorialogs-backend-plugin-linux-amd64-prod \
victorialogs-backend-plugin-linux-arm-prod \
victorialogs-backend-plugin-linux-arm64-prod \
victorialogs-backend-plugin-linux-386-prod \
victorialogs-backend-plugin-arm64-prod \
victorialogs-backend-plugin-windows-prod

victorialogs-frontend-plugin-build: \
frontend-build
Expand Down
19 changes: 2 additions & 17 deletions pkg/plugin/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,16 @@ func (d *Datasource) query(ctx context.Context, _ backend.PluginContext, query b

dec := json.NewDecoder(resp.Body)

t, err := dec.Token()
if err != nil {
return newResponseError(err, backend.StatusInternal)
}

if t != json.Delim('{') {
return newResponseError(fmt.Errorf("expected {, got %v", t), backend.StatusInternal)
}

var logs []Response
for dec.More() {
var r Response
err := dec.Decode(&r)
if err != nil {
return newResponseError(err, backend.StatusInternal)
}

log.DefaultLogger.Info("RESPONSE => %#v", r)
logs = append(logs, r)
}

// var r Response
// if err := json.NewDecoder(resp.Body).Decode(&r); err != nil {
// err = fmt.Errorf("failed to decode body response: %w", err)
// return newResponseError(err, backend.StatusInternal)
// }

// log.DefaultLogger.Info("RESPONSE => %#v", r)
// TODO convert response to the data Frames
// frames, err := r.getDataFrames()
Expand Down
11 changes: 1 addition & 10 deletions pkg/plugin/response.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
package plugin

import "encoding/json"

// Data contains fields
// ResultType which defines type of the query response
// Result resents json of the query response
type Data struct {
ResultType string `json:"resultType"`
Result json.RawMessage `json:"result"`
}

// Response contains fields from query response
// It represents victoria logs response
type Response struct {
Message string `json:"_msg"`
Stream string `json:"_stream"`
Expand Down

0 comments on commit 7e637a2

Please sign in to comment.