Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
1f1384af
Commit
1f1384af
authored
9 years ago
by
Marcin Bunsch
Committed by
Cameron Sparr
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use a single measurement with fields for timings in statsd plugin.
closes #603
parent
9d4b55be
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/statsd/statsd.go
+9
-7
9 additions, 7 deletions
plugins/inputs/statsd/statsd.go
plugins/inputs/statsd/statsd_test.go
+10
-33
10 additions, 33 deletions
plugins/inputs/statsd/statsd_test.go
with
20 additions
and
40 deletions
CHANGELOG.md
+
1
−
0
View file @
1f1384af
...
...
@@ -4,6 +4,7 @@
### Features
-
[
#564
](
https://github.com/influxdata/telegraf/issues/564
)
: features for plugin writing simplification. Internal metric data type.
-
[
#603
](
https://github.com/influxdata/telegraf/pull/603
)
: Aggregate statsd timing measurements into fields. Thanks @marcinbunsch!
### Bugfixes
-
[
#599
](
https://github.com/influxdata/telegraf/issues/599
)
: datadog plugin tags not working.
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/statsd/statsd.go
+
9
−
7
View file @
1f1384af
...
...
@@ -162,15 +162,17 @@ func (s *Statsd) Gather(acc telegraf.Accumulator) error {
defer
s
.
Unlock
()
for
_
,
metric
:=
range
s
.
timings
{
acc
.
Add
(
metric
.
name
+
"_mean"
,
metric
.
stats
.
Mean
(),
metric
.
tags
)
acc
.
Add
(
metric
.
name
+
"_stddev"
,
metric
.
stats
.
Stddev
(),
metric
.
tags
)
acc
.
Add
(
metric
.
name
+
"_upper"
,
metric
.
stats
.
Upper
(),
metric
.
tags
)
acc
.
Add
(
metric
.
name
+
"_lower"
,
metric
.
stats
.
Lower
(),
metric
.
tags
)
acc
.
Add
(
metric
.
name
+
"_count"
,
metric
.
stats
.
Count
(),
metric
.
tags
)
fields
:=
make
(
map
[
string
]
interface
{})
fields
[
"mean"
]
=
metric
.
stats
.
Mean
()
fields
[
"stddev"
]
=
metric
.
stats
.
Stddev
()
fields
[
"upper"
]
=
metric
.
stats
.
Upper
()
fields
[
"lower"
]
=
metric
.
stats
.
Lower
()
fields
[
"count"
]
=
metric
.
stats
.
Count
()
for
_
,
percentile
:=
range
s
.
Percentiles
{
name
:=
fmt
.
Sprintf
(
"%
s
_percentile
_%v"
,
metric
.
name
,
percentile
)
acc
.
Add
(
name
,
metric
.
stats
.
Percentile
(
percentile
)
,
metric
.
tags
)
name
:=
fmt
.
Sprintf
(
"%
v
_percentile
"
,
percentile
)
fields
[
name
]
=
metric
.
stats
.
Percentile
(
percentile
)
}
acc
.
AddFields
(
metric
.
name
,
fields
,
metric
.
tags
)
}
if
s
.
DeleteTimings
{
s
.
timings
=
make
(
map
[
string
]
cachedtimings
)
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/statsd/statsd_test.go
+
10
−
33
View file @
1f1384af
...
...
@@ -710,7 +710,7 @@ func TestParse_Timings(t *testing.T) {
// Test that counters work
valid_lines
:=
[]
string
{
"test.timing:1|ms"
,
"test.timing:1|ms"
,
"test.timing:1
1
|ms"
,
"test.timing:1|ms"
,
"test.timing:1|ms"
,
"test.timing:1|ms"
,
...
...
@@ -725,40 +725,17 @@ func TestParse_Timings(t *testing.T) {
s
.
Gather
(
acc
)
tests
:=
[]
struct
{
name
string
value
interface
{}
}{
{
"test_timing_mean"
,
float64
(
1
),
},
{
"test_timing_stddev"
,
float64
(
0
),
},
{
"test_timing_upper"
,
float64
(
1
),
},
{
"test_timing_lower"
,
float64
(
1
),
},
{
"test_timing_count"
,
int64
(
5
),
},
{
"test_timing_percentile_90"
,
float64
(
1
),
},
valid
:=
map
[
string
]
interface
{}{
"90_percentile"
:
float64
(
11
),
"count"
:
int64
(
5
),
"lower"
:
float64
(
1
),
"mean"
:
float64
(
3
),
"stddev"
:
float64
(
4
),
"upper"
:
float64
(
11
),
}
for
_
,
test
:=
range
tests
{
acc
.
AssertContainsFields
(
t
,
test
.
name
,
map
[
string
]
interface
{}{
"value"
:
test
.
value
})
}
acc
.
AssertContainsFields
(
t
,
"test_timing"
,
valid
)
}
func
TestParse_Timings_Delete
(
t
*
testing
.
T
)
{
...
...
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