Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
gitlab-org
gitlab-exporter
Commits
b3f80c2e
Commit
b3f80c2e
authored
Sep 29, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use regular string instead of StringIO in PrometheusMetrics#to_s
parent
4c463fe3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/gitlab_monitor/prometheus.rb
lib/gitlab_monitor/prometheus.rb
+7
-7
No files found.
lib/gitlab_monitor/prometheus.rb
View file @
b3f80c2e
...
...
@@ -18,18 +18,18 @@ module GitLab
end
def
to_s
buffer
=
StringIO
.
new
buffer
=
""
@metrics
.
each
do
|
name
,
measurements
|
measurements
.
each
do
|
measurement
|
buffer
.
write
(
name
.
to_s
)
buffer
<<
name
.
to_s
labels
=
(
measurement
[
:labels
]
||
{}).
map
{
|
label
,
value
|
"
#{
label
}
=
\"
#{
value
}
\"
"
}.
join
(
","
)
buffer
.
write
(
"{
#{
labels
}
}"
)
unless
labels
.
empty?
buffer
.
write
(
"
#{
measurement
[
:value
]
}
"
)
buffer
.
write
(
"
#{
measurement
[
:timestamp
]
}
"
)
if
@include_timestamp
buffer
.
write
(
"
\n
"
)
buffer
<<
"{
#{
labels
}
}"
unless
labels
.
empty?
buffer
<<
"
#{
measurement
[
:value
]
}
"
buffer
<<
"
#{
measurement
[
:timestamp
]
}
"
if
@include_timestamp
buffer
<<
"
\n
"
end
end
buffer
.
string
buffer
end
end
end
...
...
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