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
a2f233bb
Commit
a2f233bb
authored
Mar 16, 2022
by
Nikolay Belokolodov
Committed by
Douglas Barbosa Alexandre
Mar 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a metric to track usage of the new Export Payload button
Redis count metric is added
parent
b4bfc7b0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
2 deletions
+58
-2
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+6
-1
config/metrics/counts_all/20220314362302_service_usage_data_download_payload.yml
...ll/20220314362302_service_usage_data_download_payload.yml
+22
-0
lib/gitlab/usage_data_counters.rb
lib/gitlab/usage_data_counters.rb
+2
-1
lib/gitlab/usage_data_counters/service_usage_data_counter.rb
lib/gitlab/usage_data_counters/service_usage_data_counter.rb
+8
-0
spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+12
-0
spec/lib/gitlab/usage_data_counters/service_usage_data_counter_spec.rb
...ab/usage_data_counters/service_usage_data_counter_spec.rb
+7
-0
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+1
-0
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
a2f233bb
...
...
@@ -66,7 +66,12 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
render
html:
Gitlab
::
Highlight
.
highlight
(
'payload.json'
,
usage_data_json
,
language:
'json'
)
end
format
.
json
{
render
json:
Gitlab
::
Usage
::
ServicePingReport
.
for
(
output: :all_metrics_values
,
cached:
true
).
to_json
}
format
.
json
do
Gitlab
::
UsageDataCounters
::
ServiceUsageDataCounter
.
count
(
:download_payload_click
)
render
json:
Gitlab
::
Usage
::
ServicePingReport
.
for
(
output: :all_metrics_values
,
cached:
true
).
to_json
end
end
end
...
...
config/metrics/counts_all/20220314362302_service_usage_data_download_payload.yml
0 → 100644
View file @
a2f233bb
---
key_path
:
counts.service_usage_data_download_payload_click
description
:
Count Download Payload button clicks
data_category
:
optional
name
:
count_promoted_issues
product_section
:
growth
product_stage
:
growth
product_group
:
group::product intelligence
product_category
:
collection
value_type
:
number
status
:
active
time_frame
:
all
data_source
:
redis
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
performance_indicator_type
:
[]
milestone
:
"
14.9"
lib/gitlab/usage_data_counters.rb
View file @
a2f233bb
...
...
@@ -16,7 +16,8 @@ module Gitlab
DesignsCounter
,
KubernetesAgentCounter
,
StaticSiteEditorCounter
,
DiffsCounter
DiffsCounter
,
ServiceUsageDataCounter
].
freeze
UsageDataCounterError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/usage_data_counters/service_usage_data_counter.rb
0 → 100644
View file @
a2f233bb
# frozen_string_literal: true
module
Gitlab::UsageDataCounters
class
ServiceUsageDataCounter
<
BaseCounter
KNOWN_EVENTS
=
%w[download_payload_click]
.
freeze
PREFIX
=
'service_usage_data'
end
end
spec/controllers/admin/application_settings_controller_spec.rb
View file @
a2f233bb
...
...
@@ -81,6 +81,18 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set
expect
(
body
).
to
include
(
'counts'
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
describe
'usage data counter'
do
let
(
:counter
)
{
Gitlab
::
UsageDataCounters
::
ServiceUsageDataCounter
}
it
'incremented when json generated'
do
expect
{
get
:usage_data
,
format: :json
}.
to
change
{
counter
.
read
(
:download_payload_click
)
}.
by
(
1
)
end
it
'not incremented when html format requested'
do
expect
{
get
:usage_data
}.
not_to
change
{
counter
.
read
(
:download_payload_click
)
}
end
end
end
describe
'PUT #update'
do
...
...
spec/lib/gitlab/usage_data_counters/service_usage_data_counter_spec.rb
0 → 100644
View file @
a2f233bb
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
UsageDataCounters
::
ServiceUsageDataCounter
do
it_behaves_like
'a redis usage counter'
,
'Service Usage Data'
,
:download_payload_click
end
spec/support/helpers/usage_data_helpers.rb
View file @
a2f233bb
...
...
@@ -129,6 +129,7 @@ module UsageDataHelpers
uploads
web_hooks
user_preferences_user_gitpod_enabled
service_usage_data_download_payload_click
)
.
push
(
*
SMAU_KEYS
)
USAGE_DATA_KEYS
=
%i(
...
...
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