Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

optionally specify an agent timeout #154

Merged
merged 1 commit into from
Dec 22, 2016
Merged
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
6 changes: 5 additions & 1 deletion agent/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ func (r *HTTPReceiver) Run() {
sl, err := NewStoppableListener(tcpL, r.exit, r.conf.ConnectionLimit)
// some clients might use keep-alive and keep open their connections too long
// avoid leaks
server := http.Server{ReadTimeout: 5 * time.Second}
timeout := 5
if r.conf.ReceiverTimeout > 0 {
timeout = r.conf.ReceiverTimeout
}
server := http.Server{ReadTimeout: time.Second * time.Duration(timeout)}

go r.logStats()
go sl.Refresh(r.conf.ConnectionLimit)
Expand Down
5 changes: 5 additions & 0 deletions config/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type AgentConfig struct {
ReceiverHost string
ReceiverPort int
ConnectionLimit int // for rate-limiting, how many unique connections to allow in a lease period (30s)
ReceiverTimeout int

// internal telemetry
StatsdHost string
Expand Down Expand Up @@ -236,6 +237,10 @@ APM_CONF:
c.ConnectionLimit = v
}

if v, e := conf.GetInt("trace.receiver", "timeout"); e == nil {
c.ReceiverTimeout = v
}

ENV_CONF:
// environment variables have precedence among defaults and the config file
mergeEnv(c)
Expand Down