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
d09bb13c
Commit
d09bb13c
authored
9 years ago
by
david birdsong
Committed by
Cameron Sparr
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
special case 'value'
it usually connotes a single value type metric, appending just clutters closes #793
parent
31c323c0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/outputs/prometheus_client/prometheus_client.go
+6
-1
6 additions, 1 deletion
plugins/outputs/prometheus_client/prometheus_client.go
plugins/outputs/prometheus_client/prometheus_client_test.go
+4
-4
4 additions, 4 deletions
plugins/outputs/prometheus_client/prometheus_client_test.go
with
10 additions
and
5 deletions
plugins/outputs/prometheus_client/prometheus_client.go
+
6
−
1
View file @
d09bb13c
...
...
@@ -79,7 +79,12 @@ func (p *PrometheusClient) Write(metrics []telegraf.Metric) error {
}
for
n
,
val
:=
range
point
.
Fields
()
{
mname
:=
fmt
.
Sprintf
(
"%s_%s"
,
key
,
n
)
var
mname
string
if
n
==
"value"
{
mname
=
key
}
else
{
mname
=
fmt
.
Sprintf
(
"%s_%s"
,
key
,
n
)
}
if
_
,
ok
:=
p
.
metrics
[
mname
];
!
ok
{
p
.
metrics
[
mname
]
=
prometheus
.
NewUntypedVec
(
prometheus
.
UntypedOpts
{
...
...
This diff is collapsed.
Click to expand it.
plugins/outputs/prometheus_client/prometheus_client_test.go
+
4
−
4
View file @
d09bb13c
...
...
@@ -46,8 +46,8 @@ func TestPrometheusWritePointEmptyTag(t *testing.T) {
value
float64
tags
map
[
string
]
string
}{
{
"test_point_1
_value
"
,
0.0
,
tags
},
{
"test_point_2
_value
"
,
1.0
,
tags
},
{
"test_point_1"
,
0.0
,
tags
},
{
"test_point_2"
,
1.0
,
tags
},
}
var
acc
testutil
.
Accumulator
...
...
@@ -78,8 +78,8 @@ func TestPrometheusWritePointEmptyTag(t *testing.T) {
name
string
value
float64
}{
{
"test_point_3
_value
"
,
0.0
},
{
"test_point_4
_value
"
,
1.0
},
{
"test_point_3"
,
0.0
},
{
"test_point_4"
,
1.0
},
}
require
.
NoError
(
t
,
p
.
Gather
(
&
acc
))
...
...
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