distribution/vendor/github.com/yvasiyarov/newrelic_platform_go/agent.go

28 lines
459 B
Go
Raw Normal View History

package newrelic_platform_go
import (
"log"
"os"
)
type Agent struct {
Host string `json:"host"`
Version string `json:"version"`
Pid int `json:"pid"`
}
func NewAgent(Version string) *Agent {
agent := &Agent{
Version: Version,
}
return agent
}
func (agent *Agent) CollectEnvironmentInfo() {
var err error
agent.Pid = os.Getpid()
if agent.Host, err = os.Hostname(); err != nil {
log.Fatalf("Can not get hostname: %#v \n", err)
}
}