• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gorelic.NewAgent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/yvasiyarov/gorelic.NewAgent函数的典型用法代码示例。如果您正苦于以下问题:Golang NewAgent函数的具体用法?Golang NewAgent怎么用?Golang NewAgent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewAgent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: configureNewRelic

func configureNewRelic() {
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.NewrelicLicense = os.Getenv("NEW_RELIC_LICENSE_KEY")
	agent.NewrelicName = "Go sendgrid events handler"
	agent.Run()
}
开发者ID:gshilin,项目名称:sendgridevents,代码行数:7,代码来源:sendgrid.go


示例2: NewrelicAgentMiddleware

// NewrelicAgentMiddleware inits gorelic's NewRelic object and returns handler function
func NewrelicAgentMiddleware(license string, appname string, verbose bool) gin.HandlerFunc {
	var agent *gorelic.Agent

	if license == "" {
		return nil
	}

	agent = gorelic.NewAgent()
	agent.NewrelicLicense = license

	agent.HTTPTimer = metrics.NewTimer()
	agent.CollectHTTPStat = true
	agent.Verbose = verbose

	agent.NewrelicName = appname
	agent.Run()

	return func(c *gin.Context) {
		startTime := time.Now()
		c.Next()

		if agent != nil {
			agent.HTTPTimer.UpdateSince(startTime)
		}
	}
}
开发者ID:ri-nat,项目名称:gin-gorelic,代码行数:27,代码来源:gorelic.go


示例3: configureReporting

func configureReporting(app *handlers.App) http.Handler {
	var handler http.Handler = app

	if app.Config.Reporting.Bugsnag.APIKey != "" {
		bugsnagConfig := bugsnag.Configuration{
			APIKey: app.Config.Reporting.Bugsnag.APIKey,
			// TODO(brianbland): provide the registry version here
			// AppVersion: "2.0",
		}
		if app.Config.Reporting.Bugsnag.ReleaseStage != "" {
			bugsnagConfig.ReleaseStage = app.Config.Reporting.Bugsnag.ReleaseStage
		}
		if app.Config.Reporting.Bugsnag.Endpoint != "" {
			bugsnagConfig.Endpoint = app.Config.Reporting.Bugsnag.Endpoint
		}
		bugsnag.Configure(bugsnagConfig)

		handler = bugsnag.Handler(handler)
	}

	if app.Config.Reporting.NewRelic.LicenseKey != "" {
		agent := gorelic.NewAgent()
		agent.NewrelicLicense = app.Config.Reporting.NewRelic.LicenseKey
		if app.Config.Reporting.NewRelic.Name != "" {
			agent.NewrelicName = app.Config.Reporting.NewRelic.Name
		}
		agent.CollectHTTPStat = true
		agent.Verbose = app.Config.Reporting.NewRelic.Verbose
		agent.Run()

		handler = agent.WrapHTTPHandler(handler)
	}

	return handler
}
开发者ID:orivej,项目名称:distribution,代码行数:35,代码来源:main.go


示例4: InitNewRelicAgent

// InitNewRelicAgent initializes a new gorelic agent for usage in Handler
func InitNewRelicAgent(license string, appname string, verbose bool) (*gorelic.Agent, error) {
	if license == "" {
		return gorelic.NewAgent(), fmt.Errorf("Please specify a NewRelic license")
	}
	agent = gorelic.NewAgent()

	agent.NewrelicLicense = license
	agent.NewrelicName = appname
	agent.HTTPTimer = metrics.NewTimer()
	agent.CollectHTTPStat = true
	agent.Verbose = verbose

	agent.Run()

	return agent, nil
}
开发者ID:gabeio,项目名称:echo-middleware,代码行数:17,代码来源:gorelic.go


示例5: runLogProcesses

func runLogProcesses() {
	fmt.Println("Initialize relic ")
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.NewrelicLicense = os.Getenv("GRANTHCO_LOG_CREDENTIALS")
	agent.Run()

}
开发者ID:uglyfigurine,项目名称:granth.co,代码行数:8,代码来源:web.go


示例6: startNewRelic

func startNewRelic() {
	key := os.Getenv("NEW_RELIC_LICENSE_KEY")
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.NewrelicLicense = key

	fmt.Println("Starting NewRelic for " + key)
	agent.Run()
}
开发者ID:gistia,项目名称:slackbot,代码行数:9,代码来源:main.go


示例7: startNewrelic

func startNewrelic() {
	if cfg.NewrelicEnabled {
		nr := gorelic.NewAgent()
		nr.Verbose = cfg.NewrelicVerbose
		nr.NewrelicLicense = cfg.NewrelicKey
		nr.NewrelicName = cfg.NewrelicName
		nr.Run()
	}
}
开发者ID:nicehash,项目名称:ether-proxy,代码行数:9,代码来源:main.go


示例8: startMonitoring

func startMonitoring(license string) {
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.CollectHTTPStat = true
	agent.NewrelicLicense = license
	agent.NewrelicName = "Cloudgov Deck"
	if err := agent.Run(); err != nil {
		fmt.Println(err.Error())
	}
}
开发者ID:18F,项目名称:cg-dashboard,代码行数:10,代码来源:server.go


示例9: main

func main() {
	var (
		newrelicLicense = os.Getenv("NEWRELIC_LICENSE")
		newrelicName    = os.Getenv("NEWRELIC_NAME")
	)
	if newrelicLicense != "" && newrelicName != "" {
		agent := gorelic.NewAgent()
		agent.Verbose = true
		agent.NewrelicLicense = os.Getenv("NEWRELIC_LICENSE")
		agent.NewrelicName = os.Getenv("NEWRELIC_NAME")
		agent.Run()
	}

	m := martini.Classic()
	m.Get("/", func() string {
		return "Hello world!"
	})

	var logger *log.Logger
	logger = m.Injector.Get(reflect.TypeOf(logger)).Interface().(*log.Logger)

	m.Post("**", func(res http.ResponseWriter, req *http.Request) (int, string) {
		var (
			contentTypeHeader []string
			contentType       string
		)
		contentTypeHeader = req.Header["Content-Type"]
		if len(contentTypeHeader) > 0 {
			contentType = contentTypeHeader[0]
		} else {
			return 400, "Content-Type header is mandatory"
		}
		body, err := ioutil.ReadAll(req.Body)
		if err != nil {
			return 400, "Invalid request body"
		}
		if contentType == "application/x-php" {
			qsa := toMapStringString(req.URL.Query())
			return checkPhp(res, string(body[:]), qsa)
		}
		return 415, "Content-Type not currently supported"
	})

	var corsOrigins = os.Getenv("CORS_ORIGINS")
	if corsOrigins != "" {
		logger.Println("activating CORS: " + corsOrigins)
		m.Use(cors.Allow(&cors.Options{
			AllowOrigins: strings.Split(corsOrigins, ","),
			AllowMethods: []string{"GET", "POST"},
			AllowHeaders: []string{"Origin", "Content-Type"},
		}))
	}

	m.Run()
}
开发者ID:jokeyrhyme,项目名称:omnilint-server,代码行数:55,代码来源:omnilint-server.go


示例10: registerNewRelic

func registerNewRelic() {
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.NewrelicLicense = os.Getenv("NEWRELIC_LICENSE")
	log.Printf("NRL %s", agent.NewrelicLicense)
	agent.NewrelicName = "Gaia"
	agent.CollectHTTPStat = true
	agent.Verbose = true

	agent.Run()
}
开发者ID:NotyIm,项目名称:gaia,代码行数:11,代码来源:monitor.go


示例11: startMetrics

func startMetrics() {
	newRelicAPIKey := os.Getenv("NEW_RELIC_KEY")

	if newRelicAPIKey == "" {
		return
	}

	agent := gorelic.NewAgent()
	agent.Verbose = false
	agent.NewrelicLicense = newRelicAPIKey
	agent.Run()
}
开发者ID:Nom4d3,项目名称:go-bot,代码行数:12,代码来源:main.go


示例12: gorelicMonitor

func gorelicMonitor() {

	if envIsStaging() || envIsProduction() {
		if key := os.Getenv("NEW_RELIC_LICENSE_KEY"); key != "" {
			agent := gorelic.NewAgent()
			agent.NewrelicName = "emojitrack-gostreamer"
			agent.NewrelicLicense = key
			agent.Verbose = false
			agent.Run()
		}
	}

}
开发者ID:SunGuo,项目名称:emojitrack-gostreamer,代码行数:13,代码来源:reporter.go


示例13: initGorelic

func initGorelic() {
	if !conf.IsDev() {
		return
	}

	agent = gorelic.NewAgent()
	agent.NewrelicName = "go-gamereviews"
	agent.Verbose = true
	agent.NewrelicLicense = conf.Config.NewrelicLicense
	agent.CollectHTTPStat = true
	agent.HTTPTimer = metrics.NewTimer()
	agent.Run()
}
开发者ID:macococo,项目名称:go-gamereviews,代码行数:13,代码来源:main.go


示例14: main

func main() {

	flag.Parse()
	if *newrelicLicense == "" {
		log.Fatalf("Please, pass a valid newrelic license key.\n Use --help to get more information about available options\n")
	}
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.NewrelicLicense = *newrelicLicense
	agent.Run()

	doSomeJob(100)
}
开发者ID:jingweno,项目名称:gorelic,代码行数:13,代码来源:example1.go


示例15: main

func main() {
	flag.Parse()
	if *newrelicLicense == "" {
		log.Fatalf("Please, pass a valid newrelic license key.\n Use --help to get more information about available options\n")
	}
	agent := gorelic.NewAgent()
	agent.Verbose = true
	agent.CollectHTTPStat = true
	agent.NewrelicLicense = *newrelicLicense
	agent.Run()

	http.HandleFunc("/", agent.WrapHTTPHandlerFunc(helloServer))
	http.ListenAndServe(":8080", nil)

}
开发者ID:jingweno,项目名称:gorelic,代码行数:15,代码来源:example_web.go


示例16: NewContext

func NewContext(c *config.Config) *Context {
	var agent *gorelic.Agent = nil

	if c.NewRelic != nil && len(c.NewRelic.Key) > 0 && len(c.NewRelic.Name) > 0 {
		agent = gorelic.NewAgent()
		agent.NewrelicLicense = c.NewRelic.Key
		agent.NewrelicName = c.NewRelic.Name
		agent.Run()
	}

	return &Context{
		HeimdallOptions: c.HeimdallOptions,
		NewRelic:        agent,
	}
}
开发者ID:battle-arena,项目名称:var,代码行数:15,代码来源:context.go


示例17: New

func New(license string, appname string, verbose bool) *Gorelic {
	if license == "" {
		panic("Please specify NewRelic license")
	}

	agent := gorelic.NewAgent()
	agent.NewrelicLicense = license
	agent.HTTPTimer = metrics.NewTimer()
	agent.CollectHTTPStat = true
	agent.Verbose = verbose

	agent.NewrelicName = appname
	agent.Run()

	return &Gorelic{agent}
}
开发者ID:jingweno,项目名称:negroni-gorelic,代码行数:16,代码来源:gorelic.go


示例18: main

func main() {
	agent := gorelic.NewAgent()
	agent.NewrelicLicense = os.Getenv("NEW_RELIC_LICENSE_KEY")
	agent.Run()

	handler := routes.Handler()
	port := ":" + os.Getenv("PORT")
	http.Handle("/", handler)

	log.Println("Listening in", port)
	err := http.ListenAndServe(port, nil)

	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
开发者ID:pankajguru,项目名称:minimalweather,代码行数:16,代码来源:main.go


示例19: NewRelic

func NewRelic(license string, appname string, verbose bool) gin.HandlerFunc {
	agent = gorelic.NewAgent()
	agent.NewrelicLicense = license

	agent.HTTPTimer = metrics.NewTimer()
	agent.CollectHTTPStat = true
	agent.Verbose = verbose

	agent.NewrelicName = appname
	agent.Run()

	return func(c *gin.Context) {
		startTime := time.Now()
		c.Next()
		agent.HTTPTimer.UpdateSince(startTime)
	}
}
开发者ID:doubledutch,项目名称:dd-vote,代码行数:17,代码来源:newrelic.go


示例20: InitNewrelicAgent

// InitNewrelicAgent creates the new relic agent
func InitNewrelicAgent(license string, appname string, verbose bool, customMetrics []Metric) (gin.HandlerFunc, error) {
	if license == "" {
		return nil, fmt.Errorf("Please specify a NewRelic license")
	}

	agent = gorelic.NewAgent()
	agent.NewrelicLicense = license
	agent.HTTPTimer = metrics.NewTimer()
	agent.CollectHTTPStat = true
	agent.Verbose = verbose
	agent.NewrelicName = appname

	if customMetrics != nil {
		addCustomMetrics(customMetrics)
	}

	return Handler, agent.Run()
}
开发者ID:ronald05arias,项目名称:gin-gorelic,代码行数:19,代码来源:gorelic.go



注:本文中的github.com/yvasiyarov/gorelic.NewAgent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang newrelic_platform_go.IComponent类代码示例发布时间:2022-05-28
下一篇:
Golang ast.PositionHolder类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap