Skip to content

Commit

Permalink
🧹 bandwith (#1090)
Browse files Browse the repository at this point in the history
* 🧹 bandwith

* 🧹 bandwith

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
thibaultleouay and autofix-ci[bot] authored Nov 7, 2024
1 parent f7e4b00 commit 89ee9ab
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
9 changes: 8 additions & 1 deletion apps/checker/handlers/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,12 @@ func (h Handler) HTTPCheckerHandler(c *gin.Context) {

}

c.JSON(http.StatusOK, result)
returnData := c.Query("data")
if returnData == "true" {
c.JSON(http.StatusOK, result)

return
}

c.JSON(http.StatusOK, nil)
}
11 changes: 9 additions & 2 deletions apps/checker/handlers/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,19 @@ func (h Handler) TCPHandler(c *gin.Context) {
}
}

c.JSON(http.StatusOK, response)
returnData := c.Query("data")
if returnData == "true" {
c.JSON(http.StatusOK, response)

return
}

c.JSON(http.StatusOK, nil)
}

func (h Handler) TCPHandlerRegion(c *gin.Context) {
ctx := c.Request.Context()
dataSourceName := "check_tcp_response__v1"
dataSourceName := "check_tcp_respo…nse__v1"

region := c.Param("region")
if region == "" {
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/v1/monitors/run/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const triggerMonitor = createRoute({
200: {
content: {
"application/json": {
schema: z.array(HTTPTriggerResult).or(z.array(TCPTriggerResult)),
schema: z.array(TriggerResult),
},
},
description: "All the historical metrics",
Expand Down Expand Up @@ -218,9 +218,9 @@ export function registerRunMonitor(api: typeof monitorsApi) {
function generateUrl({ row }: { row: z.infer<typeof selectMonitorSchema> }) {
switch (row.jobType) {
case "http":
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api`;
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=true`;
case "tcp":
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api`;
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=true`;
default:
throw new Error("Invalid jobType");
}
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/v1/monitors/trigger/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ export function registerTriggerMonitor(api: typeof monitorsApi) {
function generateUrl({ row }: { row: z.infer<typeof selectMonitorSchema> }) {
switch (row.jobType) {
case "http":
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api`;
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=true`;
case "tcp":
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api`;
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=true`;
default:
throw new Error("Invalid jobType");
}
Expand Down

0 comments on commit 89ee9ab

Please sign in to comment.