Skip to content

Commit

Permalink
backend: change INFO severity to DEBUG (#213)
Browse files Browse the repository at this point in the history
With this change we reduce amount of logs printed by Grafana.
If needed, user can switch to DEBUG level to get everything logged by the plugin.

Based on plugin review recommendations.
  • Loading branch information
hagen1778 authored Jan 24, 2025
1 parent dca82ad commit 6e5b97b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func main() {
backend.Logger.Info("Starting VictoriaLogs datasource backend ...")
backend.Logger.Debug("Starting VictoriaLogs datasource backend ...")

if err := datasource.Manage("victoriametrics-logs-datasource", plugin.NewDatasource, datasource.ManageOpts{}); err != nil {
log.DefaultLogger.Error("Failed to process VictoriaLogs datasource backend: %s", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (d *Datasource) RunStream(ctx context.Context, request *backend.RunStreamRe
// TODO I can't find any of this error in the code
// so just check the error message
if strings.Contains(err.Error(), "rpc error: code = Canceled desc = context canceled") {
backend.Logger.Info("Client has canceled the request")
backend.Logger.Debug("Client has canceled the request")
break
}
backend.Logger.Error("Failed send frame", "error", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/plugin/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func parseInstantResponse(reader io.Reader) backend.DataResponse {
b, err := br.ReadBytes('\n')
if err != nil {
if errors.Is(err, bufio.ErrBufferFull) {
backend.Logger.Info("skipping line number #%d: line too long", n)
backend.Logger.Debug("skipping line number #%d: line too long", n)
continue
}
if errors.Is(err, io.EOF) {
Expand Down Expand Up @@ -172,7 +172,7 @@ func parseStreamResponse(reader io.Reader, ch chan *data.Frame) error {
b, err := br.ReadBytes('\n')
if err != nil {
if errors.Is(err, bufio.ErrBufferFull) {
backend.Logger.Info("skipping line number #%d: line too long", n)
backend.Logger.Debug("skipping line number #%d: line too long", n)
continue
}
if errors.Is(err, io.EOF) {
Expand Down

0 comments on commit 6e5b97b

Please sign in to comment.