Skip to content
代码片段 群组 项目
未验证 提交 0a3b623f 编辑于 作者: Miranda Fluharty's avatar Miranda Fluharty 提交者: GitLab
浏览文件

Track security inventory page views

Use `scripts/internal_events/cli.rb` to generate an event and a metric
Track the metric on #show in the controller
Add test to see that the metric was tracked
上级 58984162
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
"secret_detection", "secret_detection",
"security_infrastructure", "security_infrastructure",
"security_insights", "security_insights",
"security_platform_management",
"security_policies", "security_policies",
"self_managed", "self_managed",
"source_code", "source_code",
......
...@@ -13,6 +13,10 @@ class InventoryController < Groups::ApplicationController ...@@ -13,6 +13,10 @@ class InventoryController < Groups::ApplicationController
feature_category :security_asset_inventories feature_category :security_asset_inventories
include ProductAnalyticsTracking
track_internal_event :show, name: 'view_group_security_inventory'
def show; end def show; end
private private
...@@ -21,6 +25,12 @@ def ensure_feature_available! ...@@ -21,6 +25,12 @@ def ensure_feature_available!
render_404 unless License.feature_available?(:security_inventory) && render_404 unless License.feature_available?(:security_inventory) &&
::Feature.enabled?(:security_inventory_dashboard, group, type: :wip) ::Feature.enabled?(:security_inventory_dashboard, group, type: :wip)
end end
def tracking_namespace_source
group
end
def tracking_project_source; end
end end
end end
end end
---
description: Group Security Inventory page was viewed
internal_events: true
action: view_group_security_inventory
identifiers:
- namespace
- user
product_group: security_platform_management
product_categories:
- security_asset_inventories
milestone: '17.10'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183563
tiers:
- ultimate
---
key_path: redis_hll_counters.count_distinct_user_id_from_view_group_security_inventory
description: Count of unique users who viewed the group security inventory page
product_group: security_platform_management
product_categories:
- security_asset_inventories
performance_indicator_type: []
value_type: number
status: active
milestone: '17.10'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183563
time_frame:
- 28d
- 7d
data_source: internal_events
data_category: optional
tiers:
- ultimate
events:
- name: view_group_security_inventory
unique: user.id
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::Security::InventoryController, feature_category: :security_asset_inventories do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, owners: user) }
before do
stub_licensed_features(security_inventory: true)
stub_feature_flags(security_inventory_dashboard: true)
sign_in(user)
end
describe '#show', :aggregate_failures do
it_behaves_like 'internal event tracking' do
let(:event) { 'view_group_security_inventory' }
let(:namespace) { group }
subject(:request) { get group_security_inventory_path(group) }
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册