mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
31 lines
679 B
Go
31 lines
679 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.mods.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.mods.newrelic.applicationId"), opts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return deployments, nil
|
|
}
|