第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

APM Go 代理未向 APM 服務(wù)器發(fā)送數(shù)據(jù)

APM Go 代理未向 APM 服務(wù)器發(fā)送數(shù)據(jù)

Go
拉丁的傳說(shuō) 2022-06-27 10:01:38
我有一個(gè) Elastic APM-Server 啟動(dòng)并運(yùn)行,它已成功建立與 Elasticsearch 的連接。然后我安裝了一個(gè) Elastic APM Go 代理:go get -u go.elastic.co/apm它返回以下內(nèi)容:finding go.elastic.co/apm v1.8.0finding github.com/stretchr/testify v1.4.0finding github.com/prometheus/procfs v0.0.3finding github.com/google/go-cmp v0.3.1finding github.com/armon/go-radix v1.0.0finding github.com/santhosh-tekuri/jsonschema v1.2.4finding github.com/cucumber/godog v0.8.1finding golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2efinding go.elastic.co/fastjson v1.0.0finding github.com/google/go-cmp v0.5.1finding github.com/prometheus/procfs v0.1.3finding golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6efinding golang.org/x/sys latestfinding github.com/elastic/go-sysinfo v1.1.1finding golang.org/x/sync latestfinding golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98efinding github.com/stretchr/testify v1.6.1finding go.elastic.co/fastjson v1.1.0finding github.com/cucumber/godog v0.10.0finding github.com/stretchr/objx v0.3.0finding github.com/elastic/go-sysinfo v1.4.0finding gopkg.in/yaml.v2 v2.2.2finding github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901finding golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543finding github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0finding github.com/elastic/go-windows v1.0.0finding golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae然后我設(shè)置ELASTIC_APM_SERVER_URLand ELASTIC_APM_SERVICE_NAME:export ELASTIC_APM_SERVER_URL=http://my-apm-server-urlexport ELASTIC_APM_SERVICE_NAME=agent-name但是,我沒(méi)有看到代理在 APM 儀表板中注冊(cè)。它不會(huì)向 APM 服務(wù)器發(fā)送任何數(shù)據(jù)。如何確保代理正在運(yùn)行?如何檢查代理日志以了解為什么它無(wú)法連接到 APM 服務(wù)器?
查看完整描述

1 回答

?
慕田峪9158850

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊

既然您沒(méi)有在上面提到它:您是否檢測(cè)了 Go 應(yīng)用程序?Elastic APM Go“代理”是一個(gè)用于檢測(cè)應(yīng)用程序源代碼的包。它不是一個(gè)獨(dú)立的進(jìn)程,而是在您的應(yīng)用程序中運(yùn)行。


因此,首先(如果您還沒(méi)有)檢測(cè)您的應(yīng)用程序。請(qǐng)參閱https://www.elastic.co/guide/en/apm/agent/go/current/getting-started.html#instrumenting-source


這是一個(gè)使用Echo和apmechov4檢測(cè)模塊的示例 Web 服務(wù)器:


package main


import (

        "fmt"

        "net/http"


        echo "github.com/labstack/echo/v4"


        "go.elastic.co/apm/module/apmechov4"

)


func main() {

        e := echo.New()

        e.Use(apmechov4.Middleware())

        e.GET("/hello/:name", func(c echo.Context) error {

                fmt.Println(c.Param("name"))

                return nil

        })

        http.ListenAndServe(":8080", e)

}

如果您運(yùn)行它并向 發(fā)送一些請(qǐng)求http://localhost:8080/hello/world,您應(yīng)該很快就會(huì)在 Kibana 的 APM 應(yīng)用程序中看到請(qǐng)求。

http://img1.sycdn.imooc.com//62b90fbf0001dd2d18280492.jpg

如果您在 Kibana 中仍然看不到任何內(nèi)容,可以按照https://www.elastic.co/guide/en/apm/agent/go/current/troubleshooting.html#agent-logging啟用日志記錄。如果代理能夠成功地將數(shù)據(jù)發(fā)送到服務(wù)器,您可以看到以下內(nèi)容:


$ ELASTIC_APM_LOG_FILE=stderr ELASTIC_APM_LOG_LEVEL=debug go run main.go

{"level":"debug","time":"2020-08-19T13:33:28+08:00","message":"sent request with 3 transactions, 0 spans, 0 errors, 0 metricsets"}

{"level":"debug","time":"2020-08-19T13:33:46+08:00","message":"gathering metrics"}

{"level":"debug","time":"2020-08-19T13:33:56+08:00","message":"sent request with 0 transactions, 0 spans, 0 errors, 3 metricsets"}

另一方面,如果服務(wù)器無(wú)法訪問(wèn),您會(huì)看到如下內(nèi)容:


{"level":"error","time":"2020-08-19T13:38:01+08:00","message":"config request failed: sending config request failed: Get \"http://localhost:8200/config/v1/agents?service.name=main\": dial tcp 127.0.0.1:8200: connect: connection refused"}


查看完整回答
反對(duì) 回復(fù) 2022-06-27
  • 1 回答
  • 0 關(guān)注
  • 192 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)