From c3e9a572c51c9a13e8065e43572616d52a940f46 Mon Sep 17 00:00:00 2001 From: Mark Wolfe Date: Wed, 5 Jun 2024 13:21:28 +1000 Subject: [PATCH] Updated documentation and defaults --- README.md | 4 ++-- lambda/main.go | 2 +- main.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d8dcdf7..462bb76 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ To adjust timeouts, and connection pooling in the HTTP client use the following - `BUILDKITE_AGENT_METRICS_TIMEOUT` : Timeout, in seconds, TLS handshake and idle connections, for HTTP requests, to Buildkite API (default 15). - `BUILDKITE_AGENT_METRICS_MAX_IDLE_CONNS` : Maximum number of idle (keep-alive) HTTP connections - for Buildkite Agent API. Zero means no limit, -1 disables pooling (default 0). + for Buildkite Agent API. Zero means no limit, -1 disables pooling (default 100). Additionally, one of the following groups of environment variables must be set in order to define how the Lambda function should obtain the required Buildkite @@ -162,7 +162,7 @@ Usage of buildkite-agent-metrics: -interval duration Update metrics every interval, rather than once -max-idle-conns int - Maximum number of idle (keep-alive) HTTP connections for Buildkite Agent API. Zero means no limit, -1 disables pooling. + Maximum number of idle (keep-alive) HTTP connections for Buildkite Agent API. Zero means no limit, -1 disables connection reuse. (default 100) -newrelic-app-name string New Relic application name for metric events -newrelic-license-key string diff --git a/lambda/main.go b/lambda/main.go index 746c07b..7e2a2dd 100644 --- a/lambda/main.go +++ b/lambda/main.go @@ -100,7 +100,7 @@ func Handler(ctx context.Context, evt json.RawMessage) (string, error) { } if maxIdleConns == "" { - maxIdleConns = "0" // default to unlimited + maxIdleConns = "100" // Default to 100 in line with http.DefaultTransport } configuredTimeout, err := strconv.Atoi(timeout) diff --git a/main.go b/main.go index 0982842..cc4da90 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ func main() { dryRun = flag.Bool("dry-run", false, "Whether to only print metrics") endpoint = flag.String("endpoint", "https://agent.buildkite.com/v3", "A custom Buildkite Agent API endpoint") timeout = flag.Int("timeout", 15, "Timeout, in seconds, TLS handshake and idle connections, for HTTP requests, to Buildkite API") - maxIdleConns = flag.Int("max-idle-conns", 0, "Maximum number of idle (keep-alive) HTTP connections for Buildkite Agent API. Zero means no limit, -1 disables pooling.") + maxIdleConns = flag.Int("max-idle-conns", 100, "Maximum number of idle (keep-alive) HTTP connections for Buildkite Agent API. Zero means no limit, -1 disables connection reuse.") // backend config backendOpt = flag.String("backend", "cloudwatch", "Specify the backend to use: cloudwatch, newrelic, prometheus, stackdriver, statsd")