Adding newrelic application monitoring support
This commit is contained in:
parent
fc1234a448
commit
0a392f3e90
10
main.go
10
main.go
|
@ -12,6 +12,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/brandfolder/gin-gorelic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logger is a simple log handler, out puts in the standard of apache access log common.
|
// Logger is a simple log handler, out puts in the standard of apache access log common.
|
||||||
|
@ -160,6 +161,15 @@ func main() {
|
||||||
r.Use(Logger())
|
r.Use(Logger())
|
||||||
r.LoadHTMLGlob("templates/*")
|
r.LoadHTMLGlob("templates/*")
|
||||||
|
|
||||||
|
if NEWRELIC_LICENSE_KEY := os.Getenv("NEWRELIC_LICENSE_KEY"); NEWRELIC_LICENSE_KEY != "" {
|
||||||
|
var NEWRELIC_APPLICATION_NAME string
|
||||||
|
if NEWRELIC_APPLICATION_NAME = os.Getenv("NEWRELIC_APPLICATION_NAME"); NEWRELIC_APPLICATION_NAME == "" {
|
||||||
|
NEWRELIC_APPLICATION_NAME = "ifconfig.io"
|
||||||
|
}
|
||||||
|
gorelic.InitNewrelicAgent(NEWRELIC_LICENSE_KEY, NEWRELIC_APPLICATION_NAME, true)
|
||||||
|
r.Use(gorelic.Handler)
|
||||||
|
}
|
||||||
|
|
||||||
r.GET("/:field", mainHandler)
|
r.GET("/:field", mainHandler)
|
||||||
r.GET("/", mainHandler)
|
r.GET("/", mainHandler)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue