kubernetes - GCP - unable to connect to https://collector.newrelic.com

4/2/2020

I am writing a small Go code, where I am using a new relic agent to collect logs,performance etc. But whenever I am running this , the agent in my microservice is not able to connect to its server.

command":"preconnect","error":"Post https://collector.newrelic.com

I have been told to add proxyserver in my Go agent initialisation.

proxyURL, _ := url.Parse("**http://myproy.mycompany.com:3128**")
app, err := newrelic.NewApplication(
  newrelic.ConfigAppName(name),
  newrelic.ConfigLicense("**************"),
  newrelic.ConfigDebugLogger(os.Stdout),
  newrelic.ConfigDistributedTracerEnabled(true),
  func(cfg *newrelic.Config) {
    // Set specific Config fields inside a custom ConfigOption.
    cfg.Transport = &http.Transport {Proxy: http.ProxyURL(proxyURL),}
  },
)

How can I find the proxyURL in my cloud environment ?

I am dockerising my application and using a kubernetes deployment in GCP environment.

-- KVK
docker
google-cloud-platform
kubernetes
newrelic
proxy

1 Answer

4/7/2020

If I understood you question properly, you develop your application using servers directly on Compute Engine or using GKE, but cant find proxy address to use in code.

By default your instances are not behind any proxy, if only you configured it manually and applied on servers. It depend on system, but in linux you can check proxy by

env | grep -i proxy

SO, if you/someone in the team set up proxy server - you should know the address. If not - nothing to use there and you dont have a proxy and the issue with something else.

Please correct me if I understood you wrong

-- VKR
Source: StackOverflow