1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/newrelic/client.go
2018-04-06 21:14:19 -07:00

31 lines
669 B
Go

package newrelic
import (
"os"
nr "github.com/yfronto/newrelic"
)
func Application() (*nr.Application, error) {
client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY"))
application, err := client.GetApplication(Config.UInt("wtf.newrelic.applicationId"))
if err != nil {
return nil, err
}
return application, nil
}
func Deployments() ([]nr.ApplicationDeployment, error) {
client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY"))
opts := &nr.ApplicationDeploymentOptions{Page: 1}
deployments, err := client.GetApplicationDeployments(Config.UInt("wtf.newrelic.applicationId"), opts)
if err != nil {
return nil, err
}
return deployments, nil
}