Ensure database metrics are added as floats.

parent 7c3b159a
Pipeline #134341 failed with stage
in 53 seconds
...@@ -60,7 +60,7 @@ module GitLab ...@@ -60,7 +60,7 @@ module GitLab
def probe_for_type(type) def probe_for_type(type)
collector.run(type).each do |query_name, data| collector.run(type).each do |query_name, data|
METRIC_KEYS.each do |key| METRIC_KEYS.each do |key|
metrics.add("gitlab_database_bloat_#{type}_#{key}", data[key], query_name: query_name) metrics.add("gitlab_database_bloat_#{type}_#{key}", data[key].to_f, query_name: query_name)
end end
end end
......
...@@ -463,7 +463,7 @@ module GitLab ...@@ -463,7 +463,7 @@ module GitLab
other_values[key] ||= 0 other_values[key] ||= 0
other_values[key] += metric[:value] other_values[key] += metric[:value]
else else
add_ci_created_pending_builds(metric_name, metric[:value], metric) add_ci_created_pending_builds(metric_name, metric[:value].to_f, metric)
end end
end end
...@@ -479,7 +479,7 @@ module GitLab ...@@ -479,7 +479,7 @@ module GitLab
end end
def ci_stale_builds_metrics def ci_stale_builds_metrics
@metrics.add("ci_stale_builds", @results[:stale_builds]) @metrics.add("ci_stale_builds", @results[:stale_builds].to_f)
end end
def metrics_per_runner def metrics_per_runner
...@@ -519,19 +519,19 @@ module GitLab ...@@ -519,19 +519,19 @@ module GitLab
labels[:namespace] = "" unless labels[:namespace] labels[:namespace] = "" unless labels[:namespace]
selected_labels = labels.select { |k, _| allowed_labels.include?(k) }.sort.to_h selected_labels = labels.select { |k, _| allowed_labels.include?(k) }.sort.to_h
@metrics.add(metric_name, value, selected_labels) @metrics.add(metric_name, value.to_f, selected_labels)
end end
def repeated_commands_metrics def repeated_commands_metrics
@results[:repeated_commands].each do |metric| @results[:repeated_commands].each do |metric|
value = metric.delete(:value) value = metric.delete(:value)
@metrics.add("ci_repeated_commands_builds", value, metric) @metrics.add("ci_repeated_commands_builds", value.to_f, metric)
end end
end end
def unarchived_traces_metrics def unarchived_traces_metrics
@metrics.add("ci_unarchived_traces", @results[:unarchived_traces]) @metrics.add("ci_unarchived_traces", @results[:unarchived_traces].to_f)
end end
end end
end end
......
...@@ -48,13 +48,13 @@ module GitLab ...@@ -48,13 +48,13 @@ module GitLab
results.to_a.each do |row| results.to_a.each do |row|
@metrics.add( @metrics.add(
"project_remote_mirror_last_successful_update_time_seconds", "project_remote_mirror_last_successful_update_time_seconds",
row["last_successful_update_at"].to_i, row["last_successful_update_at"].to_f,
project_id: row["project_id"], project_id: row["project_id"],
url: row["url"] url: row["url"]
) )
@metrics.add( @metrics.add(
"project_remote_mirror_last_update_time_seconds", "project_remote_mirror_last_update_time_seconds",
row["last_update_at"].to_i, row["last_update_at"].to_f,
project_id: row["project_id"], project_id: row["project_id"],
url: row["url"] url: row["url"]
) )
......
...@@ -147,7 +147,7 @@ module GitLab ...@@ -147,7 +147,7 @@ module GitLab
def probe_db def probe_db
results = @collector.run results = @collector.run
results.each do |key, value| results.each do |key, value|
@metrics.add("gitlab_database_rows", value.to_i, query_name: key.to_s) @metrics.add("gitlab_database_rows", value.to_f, query_name: key.to_s)
end end
self self
......
...@@ -36,7 +36,7 @@ module GitLab ...@@ -36,7 +36,7 @@ module GitLab
result.each do |table_name, tuple_stats| result.each do |table_name, tuple_stats|
tuple_stats.each do |column_name, value| tuple_stats.each do |column_name, value|
@metrics.add("gitlab_database_stat_table_#{column_name}", @metrics.add("gitlab_database_stat_table_#{column_name}",
value, value.to_f,
table_name: table_name) unless value.is_a?(Numeric) table_name: table_name) unless value.is_a?(Numeric)
end end
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment