Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions telemetry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"
"net"
"net/http"
"net/url"
"os"
"strings"
"time"
Expand Down Expand Up @@ -52,6 +53,33 @@ func New(functionName string, licenseKey string, telemetryEndpointOverride strin
Timeout: httpClientTimeout,
}

proxyUser := os.Getenv("NEW_RELIC_PROXY_USER")
proxyPass := os.Getenv("NEW_RELIC_PROXY_PASS")
authProxyHost := os.Getenv("NEW_RELIC_PROXY_HOST")
authProxyPort := os.Getenv("NEW_RELIC_PROXY_PORT")
if authProxyHost == "" {
authProxyHost = os.Getenv("HTTPS_PROXY")
}
if authProxyHost != "" {
util.Debugf("Proxy host found: %s. Configuring Extension to use proxy.\n", authProxyHost)
proxyAddress := authProxyHost
if authProxyPort != "" {
proxyAddress = fmt.Sprintf("%s:%s", authProxyHost, authProxyPort)
}
var authProxyStr string
if proxyUser != "" {
authProxyStr = fmt.Sprintf("http://%s:%s@%s", proxyUser, proxyPass, proxyAddress)
} else {
authProxyStr = fmt.Sprintf("http://%s", proxyAddress)
}
authProxyURL, err := url.Parse(authProxyStr)
if err != nil {
log.Fatalf("Failed to parse authenticated proxy URL from env: %v", err)
}
httpClient.Transport = &http.Transport{
Proxy: http.ProxyURL(authProxyURL),
}
}
// Create random seed for timeout to avoid instances created at the same time
// from creating a wall of retry requests to the collector
var b [8]byte
Expand Down
2 changes: 1 addition & 1 deletion util/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package util

const (
Name = "newrelic-lambda-extension"
Version = "2.3.23"
Version = "2.3.24"
Id = Name + ":" + Version
)
Loading