Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
b0500666
Commit
b0500666
authored
May 08, 2018
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
telemetry: Add variance to retry interval, and disable keepalive
parent
ef48e17e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
caddy/caddymain/run.go
caddy/caddymain/run.go
+2
-2
telemetry/collection.go
telemetry/collection.go
+1
-1
telemetry/telemetry.go
telemetry/telemetry.go
+10
-3
No files found.
caddy/caddymain/run.go
View file @
b0500666
...
...
@@ -388,6 +388,6 @@ var (
gitCommit
string
// git rev-parse HEAD
gitShortStat
string
// git diff-index --shortstat
gitFilesModified
string
// git diff-index --name-only HEAD
enableTelemetry
=
true
)
const
enableTelemetry
=
true
telemetry/collection.go
View file @
b0500666
...
...
@@ -44,7 +44,7 @@ func Init(instanceID uuid.UUID, disabledMetricsKeys []string) {
instanceUUID
=
instanceID
disabledMetricsMu
.
Lock
()
for
_
,
key
:=
range
disabledMetricsKeys
{
disabledMetrics
[
key
]
=
false
disabledMetrics
[
strings
.
TrimSpace
(
key
)
]
=
false
}
disabledMetricsMu
.
Unlock
()
enabled
=
true
...
...
telemetry/telemetry.go
View file @
b0500666
...
...
@@ -38,6 +38,7 @@ import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"strconv"
"strings"
...
...
@@ -202,9 +203,9 @@ func emit(final bool) error {
// schedule the next update using our default update
// interval because the server might be healthy later
// ensure we won't slam the telemetry server
// ensure we won't slam the telemetry server
; add a little variance
if
reply
.
NextUpdate
<
1
*
time
.
Second
{
reply
.
NextUpdate
=
defaultUpdateInterval
reply
.
NextUpdate
=
defaultUpdateInterval
+
time
.
Duration
(
rand
.
Intn
(
int
(
1
*
time
.
Minute
)))
}
// schedule the next update (if this wasn't the last one and
...
...
@@ -345,7 +346,13 @@ func (s countingSet) MarshalJSON() ([]byte, error) {
var
(
// httpClient should be used for HTTP requests. It
// is configured with a timeout for reliability.
httpClient
=
http
.
Client
{
Timeout
:
1
*
time
.
Minute
}
httpClient
=
http
.
Client
{
Transport
:
&
http
.
Transport
{
TLSHandshakeTimeout
:
30
*
time
.
Second
,
DisableKeepAlives
:
true
,
},
Timeout
:
1
*
time
.
Minute
,
}
// buffer holds the data that we are building up to send.
buffer
=
make
(
map
[
string
]
interface
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment