Commit 6652f28f authored by James Lopez's avatar James Lopez

update multi file editor logic

parent 2f3923c0
...@@ -3,8 +3,6 @@ module Gitlab ...@@ -3,8 +3,6 @@ module Gitlab
class MultiFileEditor class MultiFileEditor
delegate :total, to: :commit_stats, prefix: :line_changes delegate :total, to: :commit_stats, prefix: :line_changes
METRIC_NAME = :multi_file_editor_usage
def initialize(project, current_user, commit) def initialize(project, current_user, commit)
@project, @current_user, @commit = project, current_user, commit @project, @current_user, @commit = project, current_user, commit
end end
...@@ -12,10 +10,11 @@ module Gitlab ...@@ -12,10 +10,11 @@ module Gitlab
def record def record
return unless ::License.feature_available?(:ide) return unless ::License.feature_available?(:ide)
::Gitlab::Metrics.counter( metric = WebIdeMetric.new(metric_data)
METRIC_NAME,
'Total number of commits using the multi-file web editor', unless metric.save
metric_labels) Rails.logger.error("Error persisting Web IDE metric: #{metric.as_json} - #{metric.errors.full_messages}")
end
end end
private private
...@@ -36,12 +35,12 @@ module Gitlab ...@@ -36,12 +35,12 @@ module Gitlab
@commit.stats @commit.stats
end end
def metric_labels def metric_data
{ {
project: hashed_project, project: hashed_project,
user: hashed_user, user: hashed_user,
line_changes: line_changes_total, line_count: line_changes_total,
files_count: files_total file_count: files_total
} }
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