Openstatus www.openstatus.dev

✨ refactor TCP request handling to use 'URI' instead of 'URL' for con… (#1076)

* ✨ refactor TCP request handling to use 'URI' instead of 'URL' for consistency

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

Thibault Le Ouay
autofix-ci[bot]
and committed by
GitHub
06268d86 e475b2a0

+9 -9
+7 -7
apps/checker/handlers/tcp.go
··· 99 99 100 100 op := func() error { 101 101 called++ 102 - res, err := checker.PingTcp(int(req.Timeout), req.URL) 102 + res, err := checker.PingTcp(int(req.Timeout), req.URI) 103 103 104 104 if err != nil { 105 105 return fmt.Errorf("unable to check tcp %s", err) ··· 107 107 108 108 timingAsString, err := json.Marshal(res) 109 109 if err != nil { 110 - return fmt.Errorf("error while parsing timing data %s: %w", req.URL, err) 110 + return fmt.Errorf("error while parsing timing data %s: %w", req.URI, err) 111 111 } 112 112 113 113 latency := res.TCPDone - res.TCPStart ··· 123 123 Latency: latency, 124 124 CronTimestamp: req.CronTimestamp, 125 125 Trigger: trigger, 126 - URI: req.URL, 126 + URI: req.URI, 127 127 } 128 128 129 129 response = TCPResponse{ ··· 191 191 MonitorID: monitorId, 192 192 Error: 1, 193 193 Trigger: trigger, 194 - URI: req.URL, 194 + URI: req.URI, 195 195 }, dataSourceName); err != nil { 196 196 log.Ctx(ctx).Error().Err(err).Msg("failed to send event to tinybird") 197 197 } ··· 254 254 op := func() error { 255 255 called++ 256 256 timestamp := time.Now().UTC().UnixMilli() 257 - res, err := checker.PingTcp(int(req.Timeout), req.URL) 257 + res, err := checker.PingTcp(int(req.Timeout), req.URI) 258 258 259 259 if err != nil { 260 260 return fmt.Errorf("unable to check tcp %s", err) ··· 272 272 273 273 timingAsString, err := json.Marshal(res) 274 274 if err != nil { 275 - return fmt.Errorf("error while parsing timing data %s: %w", req.URL, err) 275 + return fmt.Errorf("error while parsing timing data %s: %w", req.URI, err) 276 276 } 277 277 278 278 latency := res.TCPDone - res.TCPStart ··· 287 287 Latency: latency, 288 288 RequestId: req.RequestId, 289 289 Trigger: "api", 290 - URI: req.URL, 290 + URI: req.URI, 291 291 } 292 292 293 293 if req.RequestId != 0 {
+1 -1
apps/checker/request/request.go
··· 66 66 type TCPCheckerRequest struct { 67 67 Status string `json:"status"` 68 68 WorkspaceID string `json:"workspaceId"` 69 - URL string `json:"url"` 69 + URI string `json:"uri"` 70 70 MonitorID string `json:"monitorId"` 71 71 Trigger string `json:"trigger,omitempty"` 72 72 RawAssertions []json.RawMessage `json:"assertions,omitempty"`
+1 -1
apps/web/src/app/api/checker/test/tcp/route.ts
··· 49 49 }, 50 50 method: "POST", 51 51 body: JSON.stringify({ 52 - url, 52 + uri: url, 53 53 }), 54 54 next: { revalidate: 0 }, 55 55 });