Module: Gitlab::UsageDataCounters::GitLabCliActivityUniqueCounter

Defined in:
lib/gitlab/usage_data_counters/gitlab_cli_activity_unique_counter.rb

Constant Summary collapse

GITLAB_CLI_API_REQUEST_ACTION =
'i_code_review_user_gitlab_cli_api_request'
GITLAB_CLI_USER_AGENT_REGEX =

This regex will match to user agents ending with GitLab CLI or starting with glab/v“

%r{(GitLab\sCLI$|^glab/v)}

Class Method Summary collapse

Class Method Details

.track_api_request_when_trackable(user_agent:, user:) ⇒ Object



12
13
14
# File 'lib/gitlab/usage_data_counters/gitlab_cli_activity_unique_counter.rb', line 12

def track_api_request_when_trackable(user_agent:, user:)
  user_agent&.match?(GITLAB_CLI_USER_AGENT_REGEX) && track_unique_action_by_user(GITLAB_CLI_API_REQUEST_ACTION, user)
end