Skip to content

Instantly share code, notes, and snippets.

View HootAdam's full-sized avatar

Adam Arsenault HootAdam

View GitHub Profile
@HootAdam
HootAdam / Go Health Checks - Getting Started - Step 2
Last active April 11, 2017 03:59
Setup framework options and initialize the framework
// aboutFilePath = path for the about file for metadata about service.
// Ussually hosted in project for developers / ops to edit.
// Sample at https://github.com/hootsuite/healthchecks/blob/master/test/about.json
aboutFilePath := "conf/about.json"
// versionFilePath = path for the version file for current version of running service.
// Ussually created at build / deploy time.
// Sample at https://github.com/hootsuite/healthchecks/blob/master/test/version.txt
versionFilePath := "conf/version.txt"
@HootAdam
HootAdam / Go Health Checks - Getting Started - Step 1
Last active April 11, 2017 03:40
Define a simple sql db status check using the Go Health Checks Framework
// Create a db object by opening the connection
db, err := sql.Open("mysql", "user:password@tcp(127.0.0.1:3306)/a-db")
if err != nil {
log.Fatal(err)
}
// Define a StatusEndpoint at '/status/db' for a database dependency
dbs := healthchecks.StatusEndpoint{
Name: "The DB",
Slug: "db",
@HootAdam
HootAdam / gist:c2d165122d6d89d634287c674754a6a6
Last active April 10, 2017 17:20
How to Use the Golang Health Checks Framework
// Define a StatusEndpoint at '/status/db' for a database dependency
db := healthchecks.StatusEndpoint{
Name: "The DB",
Slug: "db",
Type: "internal",
IsTraversable: false,
StatusCheck: sqlsc.SQLDBStatusChecker{
DB: myDB
},
TraverseCheck: nil,