BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d67e2045
Commit
d67e2045
authored
Dec 14, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop empty tag values from metrics
InfluxDB throws an error when trying to store a list of tags where one or more have an empty value.
parent
5142c617
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
metrics_worker.rb
app/workers/metrics_worker.rb
+5
-1
metrics_worker_spec.rb
spec/workers/metrics_worker_spec.rb
+8
-0
No files found.
app/workers/metrics_worker.rb
View file @
d67e2045
...
...
@@ -16,7 +16,11 @@ class MetricsWorker
new_hash
=
hash
.
symbolize_keys
new_hash
[
:tags
].
each
do
|
key
,
value
|
new_hash
[
:tags
][
key
]
=
escape_value
(
value
)
if
value
.
blank?
new_hash
[
:tags
].
delete
(
key
)
else
new_hash
[
:tags
][
key
]
=
escape_value
(
value
)
end
end
new_hash
...
...
spec/workers/metrics_worker_spec.rb
View file @
d67e2045
...
...
@@ -30,6 +30,14 @@ describe MetricsWorker do
expect
(
metrics
).
to
eq
([{
values:
{},
tags:
{
'foo'
=>
'bar\\='
}
}])
end
it
'drops empty tags'
do
metrics
=
worker
.
prepare_metrics
([
{
'values'
=>
{},
'tags'
=>
{
'cats'
=>
''
,
'dogs'
=>
nil
}}
])
expect
(
metrics
).
to
eq
([{
values:
{},
tags:
{}
}])
end
end
describe
'#escape_value'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment