Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dovecot-exporter
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
Container registry
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
thirdparty
dovecot-exporter
Commits
aaa89879
Commit
aaa89879
authored
6 years ago
by
Bart Vercoulen
Browse files
Options
Downloads
Patches
Plain Diff
Fixed collectDetailMetricsFromReader to handle a row with an empty user value.
parent
d0015cea
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dovecot_exporter.go
+5
-2
5 additions, 2 deletions
dovecot_exporter.go
with
5 additions
and
2 deletions
dovecot_exporter.go
+
5
−
2
View file @
aaa89879
...
@@ -123,7 +123,7 @@ func collectDetailMetricsFromReader(reader io.Reader, scope string, ch chan<- pr
...
@@ -123,7 +123,7 @@ func collectDetailMetricsFromReader(reader io.Reader, scope string, ch chan<- pr
if
!
scanner
.
Scan
()
{
if
!
scanner
.
Scan
()
{
return
fmt
.
Errorf
(
"Failed to extract columns from input"
)
return
fmt
.
Errorf
(
"Failed to extract columns from input"
)
}
}
columnNames
:=
strings
.
Fields
(
scanner
.
Text
())
columnNames
:=
strings
.
Split
(
scanner
.
Text
()
,
"
\t
"
)
if
len
(
columnNames
)
<
2
{
if
len
(
columnNames
)
<
2
{
return
fmt
.
Errorf
(
"Input does not provide any columns"
)
return
fmt
.
Errorf
(
"Input does not provide any columns"
)
}
}
...
@@ -144,10 +144,13 @@ func collectDetailMetricsFromReader(reader io.Reader, scope string, ch chan<- pr
...
@@ -144,10 +144,13 @@ func collectDetailMetricsFromReader(reader io.Reader, scope string, ch chan<- pr
break
break
}
}
values
:=
strings
.
Fields
(
row
)
values
:=
strings
.
Split
(
row
,
"
\t
"
)
if
len
(
values
)
!=
len
(
columns
)
+
1
{
if
len
(
values
)
!=
len
(
columns
)
+
1
{
return
fmt
.
Errorf
(
"error while parsing rows: value count does not match column count"
)
return
fmt
.
Errorf
(
"error while parsing rows: value count does not match column count"
)
}
}
if
values
[
0
]
==
""
{
values
[
0
]
=
"empty_user"
}
for
i
,
value
:=
range
values
[
1
:
]
{
for
i
,
value
:=
range
values
[
1
:
]
{
f
,
err
:=
strconv
.
ParseFloat
(
value
,
64
)
f
,
err
:=
strconv
.
ParseFloat
(
value
,
64
)
...
...
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