Class: Gitlab::Instrumentation::Uploads
- Inherits:
-
Object
- Object
- Gitlab::Instrumentation::Uploads
- Defined in:
- lib/gitlab/instrumentation/uploads.rb
Constant Summary collapse
- UPLOAD_DURATION =
:uploaded_file_upload_duration_s
- UPLOADED_FILE_SIZE =
:uploaded_file_size_bytes
Class Method Summary collapse
- .get_upload_duration ⇒ Object
- .get_uploaded_file_size ⇒ Object
- .payload ⇒ Object
- .track(uploaded_file) ⇒ Object
Class Method Details
.get_upload_duration ⇒ Object
16 17 18 |
# File 'lib/gitlab/instrumentation/uploads.rb', line 16 def self.get_upload_duration ::Gitlab::SafeRequestStore[UPLOAD_DURATION] end |
.get_uploaded_file_size ⇒ Object
20 21 22 |
# File 'lib/gitlab/instrumentation/uploads.rb', line 20 def self.get_uploaded_file_size ::Gitlab::SafeRequestStore[UPLOADED_FILE_SIZE] end |
.payload ⇒ Object
24 25 26 27 28 29 |
# File 'lib/gitlab/instrumentation/uploads.rb', line 24 def self.payload { UPLOAD_DURATION => get_upload_duration, UPLOADED_FILE_SIZE => get_uploaded_file_size }.compact end |
.track(uploaded_file) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/gitlab/instrumentation/uploads.rb', line 9 def self.track(uploaded_file) if ::Gitlab::SafeRequestStore.active? ::Gitlab::SafeRequestStore[UPLOAD_DURATION] = uploaded_file.upload_duration ::Gitlab::SafeRequestStore[UPLOADED_FILE_SIZE] = uploaded_file.size end end |