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
960f4fb6
Commit
960f4fb6
authored
Sep 09, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature usage_data_api disabled by default
parent
c8c6f528
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
config/feature_flags/development/usage_data_api.yml
config/feature_flags/development/usage_data_api.yml
+1
-1
doc/development/telemetry/usage_ping.md
doc/development/telemetry/usage_ping.md
+2
-2
lib/api/usage_data.rb
lib/api/usage_data.rb
+3
-3
spec/requests/api/usage_data_spec.rb
spec/requests/api/usage_data_spec.rb
+5
-5
No files found.
config/feature_flags/development/usage_data_api.yml
View file @
960f4fb6
...
...
@@ -4,4 +4,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41301
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/235459
group
:
group::telemetry
type
:
development
default_enabled
:
tru
e
default_enabled
:
fals
e
doc/development/telemetry/usage_ping.md
View file @
960f4fb6
...
...
@@ -324,7 +324,7 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd) and [PF
| Attribute | Type | Required | Description |
| :-------- | :--- | :------- | :---------- |
|
`
name
`
| string | yes | The event name it should be tracked |
|
`
event
`
| string | yes | The event name it should be tracked |
Response
...
...
@@ -332,7 +332,7 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd) and [PF
Return 200 if tracking failed for any reason.
-
`401 Unauthorized`
if user is not authenticated
-
`400 Bad request`
if
name
parameter is missing
-
`400 Bad request`
if
event
parameter is missing
-
`200`
if event was tracked or any errors
1.
Track event using base module
`Gitlab::UsageDataCounters::HLLRedisCounter.track_event(entity_id, event_name)`
.
...
...
lib/api/usage_data.rb
View file @
960f4fb6
...
...
@@ -6,7 +6,7 @@ module API
namespace
'usage_data'
do
before
do
not_found!
unless
Feature
.
enabled?
(
:usage_data_api
,
default_enabled:
true
)
not_found!
unless
Feature
.
enabled?
(
:usage_data_api
)
end
desc
'Track usage data events'
do
...
...
@@ -14,11 +14,11 @@ module API
end
params
do
requires
:
name
,
type:
String
,
desc:
'The event name it should be tracked'
requires
:
event
,
type:
String
,
desc:
'The event name it should be tracked'
end
post
'increment_unique_users'
do
event_name
=
params
[
:
name
]
event_name
=
params
[
:
event
]
increment_unique_values
(
event_name
,
current_user
.
id
)
...
...
spec/requests/api/usage_data_spec.rb
View file @
960f4fb6
...
...
@@ -14,7 +14,7 @@ RSpec.describe API::UsageData do
it
'retruns not_found'
do
stub_feature_flags
(
usage_data_api:
false
)
post
api
(
endpoint
,
user
),
params:
{
name
:
known_event
}
post
api
(
endpoint
,
user
),
params:
{
event
:
known_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
...
...
@@ -22,7 +22,7 @@ RSpec.describe API::UsageData do
context
'without authentication'
do
it
'returns 401 response'
do
post
api
(
endpoint
),
params:
{
name
:
known_event
}
post
api
(
endpoint
),
params:
{
event
:
known_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
...
...
@@ -33,7 +33,7 @@ RSpec.describe API::UsageData do
stub_feature_flags
(
usage_data_api:
true
)
end
context
'when
name
is missing from params'
do
context
'when
event
is missing from params'
do
it
'returns bad request'
do
post
api
(
endpoint
,
user
),
params:
{}
...
...
@@ -43,7 +43,7 @@ RSpec.describe API::UsageData do
context
'with correct params'
do
it
'returns status ok'
do
post
api
(
endpoint
,
user
),
params:
{
name
:
known_event
}
post
api
(
endpoint
,
user
),
params:
{
event
:
known_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
...
...
@@ -51,7 +51,7 @@ RSpec.describe API::UsageData do
context
'with unknown event'
do
it
'returns status ok'
do
post
api
(
endpoint
,
user
),
params:
{
name
:
unknown_event
}
post
api
(
endpoint
,
user
),
params:
{
event
:
unknown_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
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