Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gostatsd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ale
gostatsd
Commits
b9b0317f
Commit
b9b0317f
authored
Sep 24, 2012
by
Kamil Kisiel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify, remove thresholds
parent
69e8200c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
34 deletions
+4
-34
gostatsd.go
gostatsd/gostatsd.go
+4
-4
aggregator.go
statsd/aggregator.go
+0
-14
util.go
statsd/util.go
+0
-16
No files found.
gostatsd/gostatsd.go
View file @
b9b0317f
...
...
@@ -21,10 +21,10 @@ func init() {
defaultGraphiteAddr
=
"localhost:2003"
defaultFlushInterval
=
10
*
time
.
Second
)
flag
.
StringVar
(
&
metricsAddr
,
"l"
,
defaultMetricsAddr
,
"
A
ddress on which to listen for metrics"
)
flag
.
StringVar
(
&
consoleAddr
,
"c"
,
defaultConsoleAddr
,
"
A
ddress on which to listen for console sessions"
)
flag
.
StringVar
(
&
graphiteAddr
,
"g"
,
defaultGraphiteAddr
,
"
A
ddress of the graphite server"
)
flag
.
DurationVar
(
&
flushInterval
,
"f"
,
defaultFlushInterval
,
"
H
ow often to flush metrics to the graphite server"
)
flag
.
StringVar
(
&
metricsAddr
,
"l"
,
defaultMetricsAddr
,
"
a
ddress on which to listen for metrics"
)
flag
.
StringVar
(
&
consoleAddr
,
"c"
,
defaultConsoleAddr
,
"
a
ddress on which to listen for console sessions"
)
flag
.
StringVar
(
&
graphiteAddr
,
"g"
,
defaultGraphiteAddr
,
"
a
ddress of the graphite server"
)
flag
.
DurationVar
(
&
flushInterval
,
"f"
,
defaultFlushInterval
,
"
h
ow often to flush metrics to the graphite server"
)
}
func
main
()
{
...
...
statsd/aggregator.go
View file @
b9b0317f
...
...
@@ -3,17 +3,10 @@ package statsd
import
(
"log"
"sort"
"strconv"
"sync"
"time"
)
var
percentThresholds
[]
float64
func
init
()
{
percentThresholds
=
[]
float64
{
90.0
}
}
// metricAggregatorStats is a bookkeeping structure for statistics about a MetricAggregator
type
metricAggregatorStats
struct
{
BadLines
int
...
...
@@ -78,13 +71,6 @@ func (m *MetricAggregator) flush() (metrics MetricMap) {
metrics
[
"stats.timers."
+
k
+
".lower"
]
=
min
metrics
[
"stats.timers."
+
k
+
".upper"
]
=
max
metrics
[
"stats.timers."
+
k
+
".count"
]
=
float64
(
count
)
for
_
,
threshold
:=
range
percentThresholds
{
mean
,
upper
:=
thresholdStats
(
v
,
threshold
)
thresholdName
:=
strconv
.
FormatFloat
(
threshold
,
'f'
,
1
,
64
)
metrics
[
"stats.timers."
+
k
+
"mean_"
+
thresholdName
]
=
mean
metrics
[
"stats.timers."
+
k
+
"upper_"
+
thresholdName
]
=
upper
}
numStats
+=
1
}
}
...
...
statsd/util.go
View file @
b9b0317f
...
...
@@ -17,19 +17,3 @@ func average(vals []float64) float64 {
}
return
sum
/
float64
(
len
(
vals
))
}
// thresholdStats calculates the mean and upper values of a list of values after a applying a minimum threshold
func
thresholdStats
(
vals
[]
float64
,
threshold
float64
)
(
mean
,
upper
float64
)
{
if
count
:=
len
(
vals
);
count
>
1
{
idx
:=
int
(
round
(((
100
-
threshold
)
/
100
)
*
float64
(
count
)))
thresholdCount
:=
count
-
idx
thresholdValues
:=
vals
[
:
thresholdCount
]
mean
=
average
(
thresholdValues
)
upper
=
thresholdValues
[
len
(
thresholdValues
)
-
1
]
}
else
{
mean
=
vals
[
0
]
upper
=
vals
[
0
]
}
return
mean
,
upper
}
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