mirror of
https://github.com/georgyo/ifconfig.io.git
synced 2025-03-14 01:25:06 +00:00
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"
|
||||
|
||||
"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.
|
||||
@ -160,6 +161,15 @@ func main() {
|
||||
r.Use(Logger())
|
||||
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("/", mainHandler)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user