-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
405 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ web: | |
bind: | ||
address: localhost | ||
port: 8080 | ||
proxies: | ||
- '::1' | ||
- '172.27.4.188' | ||
|
||
logging: | ||
json: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package alive | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// Attach takes a reference to the Gin engine and attaches all the expected | ||
// endpoints which cam be used by clients through this package. | ||
func Attach(r *gin.Engine) { | ||
r.GET("/alive", alive) | ||
} | ||
|
||
// alive provides a basic endpoint that just returns a 200 OK response with a | ||
// {"status":"alive"} JSON response, without processing, allowing to test if the | ||
// web service it up and responding to requests, regardless of any other | ||
// downstream service. | ||
func alive(c *gin.Context) { | ||
c.JSON(http.StatusOK, gin.H{ | ||
"status": "alive", | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package alive_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package healthz | ||
|
||
import ( | ||
"log/slog" | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
|
||
slogg "github.com/samber/slog-gin" | ||
) | ||
|
||
// Attach takes a reference to the Gin engine and attaches all the expected | ||
// endpoints which cam be used by clients through this package. | ||
func Attach(r *gin.Engine) { | ||
r.GET("/healthz", healthz) | ||
} | ||
|
||
// healthz provides an endpoint for checking on the operational health of the | ||
// service, checking downstream services are behaving as expected and reporting | ||
// on their overall status, allowing the service to be marked as unhealthy and | ||
// to stop processing further requests if there are known issues. | ||
func healthz(c *gin.Context) { | ||
slogg.AddCustomAttributes(c, slog.Group("healthz", slog.String("status", "ok"))) | ||
c.JSON(http.StatusOK, gin.H{ | ||
"status": "ok", | ||
"database": "unknown", | ||
"queue": "unknown", | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package healthz_test |
Oops, something went wrong.