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
e2f96172
Unverified
Commit
e2f96172
authored
8 years ago
by
Cameron Sparr
Browse files
Options
Downloads
Patches
Plain Diff
Support strings in statsd set measurements
closes #2068
parent
e097ae96
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
+8
-5
8 additions, 5 deletions
plugins/inputs/statsd/statsd.go
plugins/inputs/statsd/statsd_test.go
+7
-0
7 additions, 0 deletions
plugins/inputs/statsd/statsd_test.go
with
16 additions
and
5 deletions
CHANGELOG.md
+
1
−
0
View file @
e2f96172
...
...
@@ -18,6 +18,7 @@
-
[
#1913
](
https://github.com/influxdata/telegraf/pull/1913
)
: OpenTSDB basic auth support.
-
[
#1908
](
https://github.com/influxdata/telegraf/pull/1908
)
: RabbitMQ Connection metrics.
-
[
#1937
](
https://github.com/influxdata/telegraf/pull/1937
)
: HAProxy session limit metric.
-
[
#2068
](
https://github.com/influxdata/telegraf/issues/2068
)
: Accept strings for StatsD sets.
### Bugfixes
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/statsd/statsd.go
+
8
−
5
View file @
e2f96172
...
...
@@ -98,6 +98,7 @@ type metric struct {
hash
string
intvalue
int64
floatvalue
float64
strvalue
string
mtype
string
additive
bool
samplerate
float64
...
...
@@ -106,7 +107,7 @@ type metric struct {
type
cachedset
struct
{
name
string
fields
map
[
string
]
map
[
int64
]
bool
fields
map
[
string
]
map
[
string
]
bool
tags
map
[
string
]
string
}
...
...
@@ -435,7 +436,7 @@ func (s *Statsd) parseStatsdLine(line string) error {
return
errors
.
New
(
"Error Parsing statsd line"
)
}
m
.
floatvalue
=
v
case
"c"
,
"s"
:
case
"c"
:
var
v
int64
v
,
err
:=
strconv
.
ParseInt
(
pipesplit
[
0
],
10
,
64
)
if
err
!=
nil
{
...
...
@@ -451,6 +452,8 @@ func (s *Statsd) parseStatsdLine(line string) error {
v
=
int64
(
float64
(
v
)
/
m
.
samplerate
)
}
m
.
intvalue
=
v
case
"s"
:
m
.
strvalue
=
pipesplit
[
0
]
}
// Parse the name & tags from bucket
...
...
@@ -625,16 +628,16 @@ func (s *Statsd) aggregate(m metric) {
if
!
ok
{
s
.
sets
[
m
.
hash
]
=
cachedset
{
name
:
m
.
name
,
fields
:
make
(
map
[
string
]
map
[
int64
]
bool
),
fields
:
make
(
map
[
string
]
map
[
string
]
bool
),
tags
:
m
.
tags
,
}
}
// check if the field exists
_
,
ok
=
s
.
sets
[
m
.
hash
]
.
fields
[
m
.
field
]
if
!
ok
{
s
.
sets
[
m
.
hash
]
.
fields
[
m
.
field
]
=
make
(
map
[
int64
]
bool
)
s
.
sets
[
m
.
hash
]
.
fields
[
m
.
field
]
=
make
(
map
[
string
]
bool
)
}
s
.
sets
[
m
.
hash
]
.
fields
[
m
.
field
][
m
.
int
value
]
=
true
s
.
sets
[
m
.
hash
]
.
fields
[
m
.
field
][
m
.
str
value
]
=
true
}
}
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/statsd/statsd_test.go
+
7
−
0
View file @
e2f96172
...
...
@@ -139,6 +139,9 @@ func TestParse_Sets(t *testing.T) {
"scientific.notation.sets:4.696E+5|s"
,
"scientific.notation.sets:4.696E+5|s"
,
"scientific.notation.sets:4.697E+5|s"
,
"string.sets:foobar|s"
,
"string.sets:foobar|s"
,
"string.sets:bar|s"
,
}
for
_
,
line
:=
range
valid_lines
{
...
...
@@ -164,6 +167,10 @@ func TestParse_Sets(t *testing.T) {
"oneuser_id"
,
1
,
},
{
"string_sets"
,
2
,
},
}
for
_
,
test
:=
range
validations
{
...
...
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