Merge pull request #750 from SigNoz/fix/telemetry-bug

fix: avoid panic by handling getOutboundIP() error
This commit is contained in:
Ankit Nayan 2022-02-25 17:16:29 +05:30 committed by GitHub
commit 74170ffb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,10 @@ func getOutboundIP() string {
ip := []byte("NA")
resp, err := http.Get("https://api.ipify.org?format=text")
if err != nil {
return string(ip)
}
defer resp.Body.Close()
if err == nil {
ipBody, err := ioutil.ReadAll(resp.Body)