Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e44c3027
Commit
e44c3027
authored
Jan 30, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add multifile editor metrics
parent
a3244cac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
ee/lib/gitlab/metrics/multi_file_editor.rb
ee/lib/gitlab/metrics/multi_file_editor.rb
+47
-0
No files found.
ee/lib/gitlab/metrics/multi_file_editor.rb
0 → 100644
View file @
e44c3027
module
Gitlab
module
Metrics
class
MultiFileEditor
delegate
:total
,
to: :commit_stats
,
prefix: :line_changes
METRIC_NAME
=
:multi_file_editor_usage
def
initialize
(
project
,
current_user
,
commit
)
@project
,
@current_user
,
@commit
=
project
,
current_user
,
@commit
=
commit
end
def
record
::
Gitlab
::
Metrics
.
counter
(
METRIC_NAME
,
'Total number of commits using the multi-file web editor'
,
metric_labels
)
end
private
def
files_total
@commit
.
diffs
.
size
end
def
hashed_project
Digest
::
SHA256
.
hexdigest
(
"
#{
@project
.
id
}
-
#{
Rails
.
application
.
secrets
.
secret_key_base
}
"
)
end
def
hashed_user
Digest
::
SHA256
.
hexdigest
(
"
#{
@current_user
.
id
}
-
#{
Rails
.
application
.
secrets
.
secret_key_base
}
"
)
end
def
commit_stats
@commit
.
stats
end
def
metric_labels
{
project:
hashed_project
,
user:
hashed_user
,
line_changes:
line_changes_total
,
files_count:
files_total
}
end
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