Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake
Commits
175b8efb
Commit
175b8efb
authored
Jun 11, 2019
by
Cecylia Bocovich
Browse files
Bin metrics to nearest mult of 8
parent
0293674e
Changes
1
Hide whitespace changes
Inline
Side-by-side
broker/metrics.go
View file @
175b8efb
...
...
@@ -4,6 +4,7 @@ import (
// "golang.org/x/net/internal/timeseries"
"fmt"
"log"
"math"
"net"
"sync"
"time"
...
...
@@ -112,9 +113,9 @@ func (m *Metrics) logMetrics() {
for
range
heartbeat
{
m
.
logger
.
Println
(
"snowflake-stats-end "
)
m
.
logger
.
Println
(
"snowflake-ips "
,
m
.
countryStats
.
Display
())
m
.
logger
.
Println
(
"snowflake-idle-count "
,
m
.
proxyIdleCount
)
m
.
logger
.
Println
(
"client-denied-count "
,
m
.
clientDeniedCount
)
m
.
logger
.
Println
(
"client-snowflake-match-count "
,
m
.
clientProxyMatchCount
)
m
.
logger
.
Println
(
"snowflake-idle-count "
,
binCount
(
m
.
proxyIdleCount
)
)
m
.
logger
.
Println
(
"client-denied-count "
,
binCount
(
m
.
clientDeniedCount
)
)
m
.
logger
.
Println
(
"client-snowflake-match-count "
,
binCount
(
m
.
clientProxyMatchCount
)
)
//restore all metrics to original values
m
.
proxyIdleCount
=
0
...
...
@@ -123,3 +124,8 @@ func (m *Metrics) logMetrics() {
m
.
countryStats
.
counts
=
make
(
map
[
string
]
int
)
}
}
// Rounds up a count to the nearest multiple of 8.
func
binCount
(
count
int
)
int
{
return
int
((
math
.
Ceil
(
float64
(
count
)
/
8
))
*
8
)
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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