caas-team / sparrow

A monitoring tool to gather infrastructure network information
Apache License 2.0
6 stars 4 forks source link

fix: return error to trigger retry mechanism #90

Closed lvlcn-t closed 8 months ago

lvlcn-t commented 8 months ago

Motivation

Closes #89

Changes

For additional information look at the commits.

Tests done

$ go run main.go run --config .tmp/start-config.yaml 
Using config file: .tmp/start-config.yaml
{"time":"2024-01-25T15:50:35.826594494+01:00","level":"INFO","source":{"function":"github.com/caas-team/sparrow/cmd.NewCmdRun.run.func1","file":"/home/installadm/dev/github/sparrow/cmd/run.go","line":82},"msg":"Running sparrow"}
{"time":"2024-01-25T15:50:35.826697304+01:00","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow.(*Sparrow).api.func1","file":"/home/installadm/dev/github/sparrow/pkg/sparrow/api.go","line":81},"msg":"Serving Api","addr":":8080"}
{"time":"2024-01-25T15:50:35.826844899+01:00","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/config.(*FileLoader).Run","file":"/home/installadm/dev/github/sparrow/pkg/config/file.go","line":48},"msg":"Reading config from file","file":"./.tmp/run-config.yaml"}
{"time":"2024-01-25T15:50:35.8270253+01:00","level":"WARN","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow.(*Sparrow).registerCheck","file":"/home/installadm/dev/github/sparrow/pkg/sparrow/run.go","line":232},"msg":"Check is not registered","name":"dns"}
{"time":"2024-01-25T15:50:35.827046845+01:00","level":"WARN","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow.(*Sparrow).registerCheck","file":"/home/installadm/dev/github/sparrow/pkg/sparrow/run.go","line":232},"msg":"Check is not registered","name":"health"}
{"time":"2024-01-25T15:50:35.827123454+01:00","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.(*Latency).Run","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":91},"msg":"Starting latency check","interval":"20s"}
{"time":"2024-01-25T15:50:35.827157113+01:00","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets.(*gitlabTargetManager).Reconcile","file":"/home/installadm/dev/github/sparrow/pkg/sparrow/targets/gitlab.go","line":80},"msg":"Starting global gitlabTargetManager reconciler"}
{"time":"2024-01-25T15:50:55.840979008+01:00","level":"ERROR","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.getLatency","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":284},"msg":"Error while checking latency","url":"xhttps://example.com","error":"Get \"xhttps://example.com\": unsupported protocol scheme \"xhttps\""}
{"time":"2024-01-25T15:50:55.841049657+01:00","level":"WARN","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.(*Latency).check.Retry.func3","file":"/home/installadm/dev/github/sparrow/internal/helper/retry.go","line":49},"msg":"Effector call failed, retrying in 1s"}
{"time":"2024-01-25T15:50:56.84142655+01:00","level":"ERROR","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.getLatency","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":284},"msg":"Error while checking latency","url":"xhttps://example.com","error":"Get \"xhttps://example.com\": unsupported protocol scheme \"xhttps\""}
{"time":"2024-01-25T15:50:56.841466066+01:00","level":"WARN","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.(*Latency).check.Retry.func3","file":"/home/installadm/dev/github/sparrow/internal/helper/retry.go","line":49},"msg":"Effector call failed, retrying in 2s"}
{"time":"2024-01-25T15:50:58.842592321+01:00","level":"ERROR","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.getLatency","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":284},"msg":"Error while checking latency","url":"xhttps://example.com","error":"Get \"xhttps://example.com\": unsupported protocol scheme \"xhttps\""}
{"time":"2024-01-25T15:50:58.842645854+01:00","level":"WARN","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.(*Latency).check.Retry.func3","file":"/home/installadm/dev/github/sparrow/internal/helper/retry.go","line":49},"msg":"Effector call failed, retrying in 4s"}
{"time":"2024-01-25T15:51:02.842859847+01:00","level":"ERROR","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.getLatency","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":284},"msg":"Error while checking latency","url":"xhttps://example.com","error":"Get \"xhttps://example.com\": unsupported protocol scheme \"xhttps\""}
{"time":"2024-01-25T15:51:02.842899427+01:00","level":"ERROR","source":{"function":"github.com/caas-team/sparrow/pkg/checks/latency.(*Latency).check.func2","file":"/home/installadm/dev/github/sparrow/pkg/checks/latency/latency.go","line":249},"msg":"Error while checking latency","target":"xhttps://example.com","error":"Get \"xhttps://example.com\": unsupported protocol scheme \"xhttps\""}

TODO