Skip to content

Open-source status page, incident response and uptime monitoring

📝 improve logging (#567)

Thibault Le Ouay92eca51ead15
diff --git a/apps/checker/cmd/main.go b/apps/checker/cmd/main.go
index 6f7d4a084..bb6467203 100644
--- a/apps/checker/cmd/main.go
+++ b/apps/checker/cmd/main.go
@@ -64,12 +64,16 @@ func main() {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
return
}
+ fmt.Printf("🚀 Start processing for %+v \n", req)
response, err := checker.Ping(ctx, httpClient, req)
if err != nil {
+ fmt.Printf("1️⃣ first retry for %+v \n", req)
// Add one more retry
response, err = checker.Ping(ctx, httpClient, req)
if err != nil {
+ fmt.Printf("2️⃣ second retry for %+v \n", req)
+
checker.SendToTinyBird(ctx, checker.PingData{
URL: req.URL,
Region: flyRegion,
diff --git a/apps/checker/fly.toml b/apps/checker/fly.toml
index 5d89197fe..8e1236803 100644
--- a/apps/checker/fly.toml
+++ b/apps/checker/fly.toml
@@ -34,4 +34,9 @@ primary_region = "ams"
interval = "15s"
method = "GET"
timeout = "5s"
- path = "/ping"
\ No newline at end of file
+ path = "/ping"
+
+[http_service.concurrency]
+ type = "requests"
+ hard_limit = 1000
+ soft_limit = 500
\ No newline at end of file
diff --git a/apps/checker/go.mod b/apps/checker/go.mod
index 757997923..d86540014 100644
--- a/apps/checker/go.mod
+++ b/apps/checker/go.mod
@@ -20,7 +20,7 @@ require (
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
- github.com/mattn/go-isatty v0.0.19 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
@@ -29,7 +29,7 @@ require (
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
- golang.org/x/sys v0.12.0 // indirect
+ golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
diff --git a/apps/checker/go.sum b/apps/checker/go.sum
index bfd1a25b2..11f3db051 100644
--- a/apps/checker/go.sum
+++ b/apps/checker/go.sum
@@ -41,6 +41,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -81,6 +83,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
+golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
diff --git a/apps/checker/ping.go b/apps/checker/ping.go
index 44eeaad2a..95c3c584f 100644
--- a/apps/checker/ping.go
+++ b/apps/checker/ping.go
@@ -85,12 +85,12 @@ func Ping(ctx context.Context, client *http.Client, inputData request.CheckerReq
}
logger.Error().Err(err).Msg("error while pinging")
- return PingData{}, fmt.Errorf("error with monitor %s: %w", inputData.URL, err)
+ return PingData{}, fmt.Errorf("error with monitorURL %s: %w", inputData.URL, err)
}
defer response.Body.Close()
if _, err := io.ReadAll(response.Body); err != nil {
- logger.Error().Err(err).Str("monitor", inputData.URL).Msg("error while reading body")
+ logger.Error().Err(err).Str("monitorURL", inputData.URL).Msg("error while reading body")
return PingData{}, fmt.Errorf("error while reading body from %s: %w", inputData.URL, err)
}
diff --git a/apps/server/fly.toml b/apps/server/fly.toml
index 56163796e..d2dac027f 100644
--- a/apps/server/fly.toml
+++ b/apps/server/fly.toml
@@ -23,7 +23,7 @@ primary_region = "ams"
min_machines_running = 1
processes = ["app"]
- [http_service.concurrency]
+[http_service.concurrency]
type = "requests"
hard_limit = 1000
soft_limit = 500