Commit 960f4fb6 authored by alinamihaila's avatar alinamihaila

Feature usage_data_api disabled by default

parent c8c6f528
......@@ -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: true
default_enabled: false
......@@ -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)`.
......
......@@ -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)
......
......@@ -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
......
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