Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gostatsd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
gostatsd
Commits
b9b0317f
Commit
b9b0317f
authored
12 years ago
by
Kamil Kisiel
Browse files
Options
Downloads
Patches
Plain Diff
Simplify, remove thresholds
parent
69e8200c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gostatsd/gostatsd.go
+4
-4
4 additions, 4 deletions
gostatsd/gostatsd.go
statsd/aggregator.go
+0
-14
0 additions, 14 deletions
statsd/aggregator.go
statsd/util.go
+0
-16
0 additions, 16 deletions
statsd/util.go
with
4 additions
and
34 deletions
gostatsd/gostatsd.go
+
4
−
4
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
()
{
...
...
This diff is collapsed.
Click to expand it.
statsd/aggregator.go
+
0
−
14
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
}
}
...
...
This diff is collapsed.
Click to expand it.
statsd/util.go
+
0
−
16
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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment