diff --git a/app/graphql/mutations/alert_management/alerts/set_assignees.rb b/app/graphql/mutations/alert_management/alerts/set_assignees.rb index c986111d29055acd0702d38103143f978eb43431..500e2b868b1210700e055f22c823c4c5519bac25 100644 --- a/app/graphql/mutations/alert_management/alerts/set_assignees.rb +++ b/app/graphql/mutations/alert_management/alerts/set_assignees.rb @@ -20,7 +20,7 @@ def resolve(args) alert = authorized_find!(project_path: args[:project_path], iid: args[:iid]) result = set_assignees(alert, args[:assignee_usernames], args[:operation_mode]) - track_usage_event(:incident_management_alert_assigned, current_user.id) + track_alert_events('incident_management_alert_assigned', alert) prepare_response(result) end diff --git a/app/graphql/mutations/alert_management/alerts/todo/create.rb b/app/graphql/mutations/alert_management/alerts/todo/create.rb index 2a1056e8f648c49c51feee7ee65fe51fb6e104fb..999c0bec5af2c7f2c7f827eeab3cb89ae1b403e1 100644 --- a/app/graphql/mutations/alert_management/alerts/todo/create.rb +++ b/app/graphql/mutations/alert_management/alerts/todo/create.rb @@ -11,7 +11,7 @@ def resolve(args) alert = authorized_find!(project_path: args[:project_path], iid: args[:iid]) result = ::AlertManagement::Alerts::Todo::CreateService.new(alert, current_user).execute - track_usage_event(:incident_management_alert_todo, current_user.id) + track_alert_events('incident_management_alert_todo', alert) prepare_response(result) end diff --git a/app/graphql/mutations/alert_management/base.rb b/app/graphql/mutations/alert_management/base.rb index d01f200107c3ee2396df3caa6ee10283220be4ec..2eef6bb9db7615f511da4554a95357ca1883ca64 100644 --- a/app/graphql/mutations/alert_management/base.rb +++ b/app/graphql/mutations/alert_management/base.rb @@ -39,6 +39,24 @@ def find_object(project_path:, **args) ::AlertManagement::AlertsFinder.new(current_user, project, args).execute.first end + + def track_alert_events(event, alert) + project = alert.project + namespace = project.namespace + track_usage_event(event, current_user.id) + + return unless Feature.enabled?(:route_hll_to_snowplow_phase2, namespace) + + Gitlab::Tracking.event( + self.class.to_s, + event, + project: project, + namespace: namespace, + user: current_user, + label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context] + ) + end end end end diff --git a/app/graphql/mutations/alert_management/create_alert_issue.rb b/app/graphql/mutations/alert_management/create_alert_issue.rb index 77a7d7a414700f031e2a72e48301fb62ce714942..7c8de6365e7a882c2d60b19ec243d1e7e2f96b51 100644 --- a/app/graphql/mutations/alert_management/create_alert_issue.rb +++ b/app/graphql/mutations/alert_management/create_alert_issue.rb @@ -9,7 +9,7 @@ def resolve(args) alert = authorized_find!(project_path: args[:project_path], iid: args[:iid]) result = create_alert_issue(alert, current_user) - track_usage_event(:incident_management_incident_created, current_user.id) + track_alert_events('incident_management_incident_created', alert) track_usage_event(:incident_management_alert_create_incident, current_user.id) prepare_response(alert, result) diff --git a/app/graphql/mutations/alert_management/update_alert_status.rb b/app/graphql/mutations/alert_management/update_alert_status.rb index 21566c7d66f3610e2fc3a4186c688da0bb6baad4..be271a7d795615aceb40af06445d4253aab87e12 100644 --- a/app/graphql/mutations/alert_management/update_alert_status.rb +++ b/app/graphql/mutations/alert_management/update_alert_status.rb @@ -13,7 +13,7 @@ def resolve(project_path:, iid:, status:) alert = authorized_find!(project_path: project_path, iid: iid) result = update_status(alert, status) - track_usage_event(:incident_management_alert_status_changed, current_user.id) + track_alert_events('incident_management_alert_status_changed', alert) prepare_response(result) end diff --git a/app/services/concerns/incident_management/usage_data.rb b/app/services/concerns/incident_management/usage_data.rb index 27e60029ea389b99b9aaf434ef499462f4b58d04..40183085344adf46153b82a495d99e7a60c7ba34 100644 --- a/app/services/concerns/incident_management/usage_data.rb +++ b/app/services/concerns/incident_management/usage_data.rb @@ -7,7 +7,23 @@ module UsageData def track_incident_action(current_user, target, action) return unless target.incident? - track_usage_event(:"incident_management_#{action}", current_user.id) + event = "incident_management_#{action}" + track_usage_event(event, current_user.id) + + namespace = target.try(:namespace) + project = target.try(:project) + + return unless Feature.enabled?(:route_hll_to_snowplow_phase2, target.try(:namespace)) + + Gitlab::Tracking.event( + self.class.to_s, + event, + project: project, + namespace: namespace, + user: current_user, + label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context] + ) end end end diff --git a/app/services/incident_management/timeline_events/base_service.rb b/app/services/incident_management/timeline_events/base_service.rb index 7168e2fdd38078ec261df056397364d255942705..1de382273dec754effe1ebbc5bb626cdfbe621f5 100644 --- a/app/services/incident_management/timeline_events/base_service.rb +++ b/app/services/incident_management/timeline_events/base_service.rb @@ -24,6 +24,23 @@ def error_no_permissions def error_in_save(timeline_event) error(timeline_event.errors.full_messages.to_sentence) end + + def track_timeline_event(event, project) + namespace = project.namespace + track_usage_event(event, user.id) + + return unless Feature.enabled?(:route_hll_to_snowplow_phase2, namespace) + + Gitlab::Tracking.event( + self.class.to_s, + event, + project: project, + namespace: namespace, + user: user, + label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context] + ) + end end end end diff --git a/app/services/incident_management/timeline_events/create_service.rb b/app/services/incident_management/timeline_events/create_service.rb index 71ff5b645159c8f30edc7d583e5414efb25ed0c0..3dd9bc172e2764bceda1a7d8b4b392c65fa1d67d 100644 --- a/app/services/incident_management/timeline_events/create_service.rb +++ b/app/services/incident_management/timeline_events/create_service.rb @@ -106,7 +106,7 @@ def execute create_timeline_event_tag_links(timeline_event, params[:timeline_event_tag_names]) - track_usage_event(:incident_management_timeline_event_created, user.id) + track_timeline_event("incident_management_timeline_event_created", project) success(timeline_event) else diff --git a/app/services/incident_management/timeline_events/destroy_service.rb b/app/services/incident_management/timeline_events/destroy_service.rb index e1c6bbbdb8519c193b4f0d5a18d8ccaf89283215..aba46cdda273d58c6cded1143607e54659608302 100644 --- a/app/services/incident_management/timeline_events/destroy_service.rb +++ b/app/services/incident_management/timeline_events/destroy_service.rb @@ -18,7 +18,7 @@ def execute if timeline_event.destroy add_system_note(incident, user) - track_usage_event(:incident_management_timeline_event_deleted, user.id) + track_timeline_event('incident_management_timeline_event_deleted', project) success(timeline_event) else error_in_save(timeline_event) diff --git a/app/services/incident_management/timeline_events/update_service.rb b/app/services/incident_management/timeline_events/update_service.rb index 0e424f86e1a5ee9923dacab4d3b2e39553848d2e..dd67c6238c85022dfc76c6ca1813148b6d952749 100644 --- a/app/services/incident_management/timeline_events/update_service.rb +++ b/app/services/incident_management/timeline_events/update_service.rb @@ -43,7 +43,7 @@ def execute if timeline_event_saved add_system_note(timeline_event) - track_usage_event(:incident_management_timeline_event_edited, user.id) + track_timeline_event('incident_management_timeline_event_edited', timeline_event.project) success(timeline_event) else error_in_save(timeline_event) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 0aed9e3ba40e228cde74dcb7911968bfdca7134f..71cc5581ae670d61dd89d41f5c1bff8ae02c8c32 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -146,7 +146,7 @@ def handle_confidential_change(issue) # don't enqueue immediately to prevent todos removal in case of a mistake TodosDestroyer::ConfidentialIssueWorker.perform_in(Todo::WAIT_FOR_DELETE, issue.id) if issue.confidential? create_confidentiality_note(issue) - track_usage_event(:incident_management_incident_change_confidential, current_user.id) + track_incident_action(current_user, issue, :incident_change_confidential) end end diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index 5b0ef44dad4cc5532feda9d6dcf6230db5050cf7..9ae31f8ac58ae5f812beb582ee3246e298d674e8 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -166,8 +166,9 @@ def new_award_emoji(awardable, current_user) # When user marks a target as todo def mark_todo(target, current_user) - attributes = attributes_for_todo(target.project, target, current_user, Todo::MARKED) - create_todos(current_user, attributes) + project = target.project + attributes = attributes_for_todo(project, target, current_user, Todo::MARKED) + create_todos(current_user, attributes, project&.namespace, project) end def todo_exist?(issuable, current_user) @@ -214,8 +215,9 @@ def restore_todo(todo, current_user) end def create_request_review_todo(target, author, reviewers) - attributes = attributes_for_todo(target.project, target, author, Todo::REVIEW_REQUESTED) - create_todos(reviewers, attributes) + project = target.project + attributes = attributes_for_todo(project, target, author, Todo::REVIEW_REQUESTED) + create_todos(reviewers, attributes, project.namespace, project) end def create_member_access_request(member) @@ -225,12 +227,20 @@ def create_member_access_request(member) approvers = source.access_request_approvers_to_be_notified.map(&:user) return true if approvers.empty? - create_todos(approvers, attributes) + if source.instance_of? Project + project = source + namespace = project.namespace + else + project = nil + namespace = source + end + + create_todos(approvers, attributes, namespace, project) end private - def create_todos(users, attributes) + def create_todos(users, attributes, namespace, project) users = Array(users) return if users.empty? @@ -256,7 +266,7 @@ def create_todos(users, attributes) todos = users.map do |user| issue_type = attributes.delete(:issue_type) - track_todo_creation(user, issue_type) + track_todo_creation(user, issue_type, namespace, project) Todo.create(attributes.merge(user_id: user.id)) end @@ -296,9 +306,10 @@ def handle_note(note, author, skip_users = []) def create_assignment_todo(target, author, old_assignees = []) if target.assignees.any? + project = target.project assignees = target.assignees - old_assignees - attributes = attributes_for_todo(target.project, target, author, Todo::ASSIGNED) - create_todos(assignees, attributes) + attributes = attributes_for_todo(project, target, author, Todo::ASSIGNED) + create_todos(assignees, attributes, project.namespace, project) end end @@ -313,22 +324,24 @@ def create_mention_todos(parent, target, author, note = nil, skip_users = []) # Create Todos for directly addressed users directly_addressed_users = filter_directly_addressed_users(parent, note || target, author, skip_users) attributes = attributes_for_todo(parent, target, author, Todo::DIRECTLY_ADDRESSED, note) - create_todos(directly_addressed_users, attributes) + create_todos(directly_addressed_users, attributes, parent&.namespace, parent) # Create Todos for mentioned users mentioned_users = filter_mentioned_users(parent, note || target, author, skip_users + directly_addressed_users) attributes = attributes_for_todo(parent, target, author, Todo::MENTIONED, note) - create_todos(mentioned_users, attributes) + create_todos(mentioned_users, attributes, parent&.namespace, parent) end def create_build_failed_todo(merge_request, todo_author) - attributes = attributes_for_todo(merge_request.project, merge_request, todo_author, Todo::BUILD_FAILED) - create_todos(todo_author, attributes) + project = merge_request.project + attributes = attributes_for_todo(project, merge_request, todo_author, Todo::BUILD_FAILED) + create_todos(todo_author, attributes, project.namespace, project) end def create_unmergeable_todo(merge_request, todo_author) - attributes = attributes_for_todo(merge_request.project, merge_request, todo_author, Todo::UNMERGEABLE) - create_todos(todo_author, attributes) + project = merge_request.project + attributes = attributes_for_todo(project, merge_request, todo_author, Todo::UNMERGEABLE) + create_todos(todo_author, attributes, project.namespace, project) end def attributes_for_target(target) @@ -392,10 +405,23 @@ def pending_todos(users, criteria = {}) PendingTodosFinder.new(users, criteria).execute end - def track_todo_creation(user, issue_type) + def track_todo_creation(user, issue_type, namespace, project) return unless issue_type == 'incident' - track_usage_event(:incident_management_incident_todo, user.id) + event = "incident_management_incident_todo" + track_usage_event(event, user.id) + + return unless Feature.enabled?(:route_hll_to_snowplow_phase2, namespace) + + Gitlab::Tracking.event( + self.class.to_s, + event, + project: project, + namespace: namespace, + user: user, + label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context] + ) end def attributes_for_access_request_todos(source, author, action, note = nil) diff --git a/config/events/1669814629_StatusPage__PublishService_incident_management_incident_published.yml b/config/events/1669814629_StatusPage__PublishService_incident_management_incident_published.yml new file mode 100644 index 0000000000000000000000000000000000000000..9e6f699786b28769d9689e7a979496dddd5df1c2 --- /dev/null +++ b/config/events/1669814629_StatusPage__PublishService_incident_management_incident_published.yml @@ -0,0 +1,24 @@ +--- +description: Mirrored Service Ping Redis metric. Count of unique users that published incidents per month +category: StatusPage::PublishService +action: incident_management_incident_published +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ee +tiers: +- premium +- ultimate + diff --git a/config/events/1669815074_Mutations__AlertManagement__Alerts__Todo__Create_incident_management_alert_todo.yml b/config/events/1669815074_Mutations__AlertManagement__Alerts__Todo__Create_incident_management_alert_todo.yml new file mode 100644 index 0000000000000000000000000000000000000000..f94db886c519663009fa580b742e04bb71608f1d --- /dev/null +++ b/config/events/1669815074_Mutations__AlertManagement__Alerts__Todo__Create_incident_management_alert_todo.yml @@ -0,0 +1,26 @@ +--- +description: Migrated Service Ping metric. Count of unique users adding alerts to the TODO list +category: Mutations::AlertManagement::Alerts::Todo::Create +action: incident_management_alert_todo +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223/diffs +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669817378_Mutations__AlertManagement__Alerts__SetAssignees_incident_management_alert_assigned.yml b/config/events/1669817378_Mutations__AlertManagement__Alerts__SetAssignees_incident_management_alert_assigned.yml new file mode 100644 index 0000000000000000000000000000000000000000..4b2c786149fd6537fe2503e3fbc535e000f4ca3b --- /dev/null +++ b/config/events/1669817378_Mutations__AlertManagement__Alerts__SetAssignees_incident_management_alert_assigned.yml @@ -0,0 +1,26 @@ +--- +description: Count of unique users assigning an alert per week. Migrated form Service Ping metric +category: Mutations::AlertManagement::Alerts::SetAssignees +action: incident_management_alert_assigned +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669817630_Mutations__AlertManagement__CreateAlertIssue_incident_management_incident_created.yml b/config/events/1669817630_Mutations__AlertManagement__CreateAlertIssue_incident_management_incident_created.yml new file mode 100644 index 0000000000000000000000000000000000000000..28bd7ba89c62dc118e79b6ff2c8fb5cecf3df32d --- /dev/null +++ b/config/events/1669817630_Mutations__AlertManagement__CreateAlertIssue_incident_management_incident_created.yml @@ -0,0 +1,26 @@ +--- +description: Migrated from Service Ping metric. Count of unique users creating incidents +category: Mutations::AlertManagement::CreateAlertIssue +action: incident_management_incident_created +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669817815_Mutations__AlertManagement__UpdateAlertStatus_incident_management_alert_status_change.yml b/config/events/1669817815_Mutations__AlertManagement__UpdateAlertStatus_incident_management_alert_status_change.yml new file mode 100644 index 0000000000000000000000000000000000000000..409d1186348a03ea3e59c928102bde70b2f77a41 --- /dev/null +++ b/config/events/1669817815_Mutations__AlertManagement__UpdateAlertStatus_incident_management_alert_status_change.yml @@ -0,0 +1,26 @@ +--- +description: Count of unique users changing alert's status. Migrated from Service Ping metric +category: Mutations::AlertManagement::UpdateAlertStatus +action: incident_management_alert_status_changed +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669818009_IncidentManagement__TimelineEvents__CreateService_incident_management_timeline_event_.yml b/config/events/1669818009_IncidentManagement__TimelineEvents__CreateService_incident_management_timeline_event_.yml new file mode 100644 index 0000000000000000000000000000000000000000..b3033c4aa3bd9b65d4691fb2d9371905d977c862 --- /dev/null +++ b/config/events/1669818009_IncidentManagement__TimelineEvents__CreateService_incident_management_timeline_event_.yml @@ -0,0 +1,27 @@ +--- +description: Count of unique users created timeline events +category: IncidentManagement::TimelineEvents::CreateService +action: incident_management_timeline_event_created +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: respond +product_category: incident_management +value_type: number +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669902189_IncidentManagement__TimelineEvents__DestroyService_incident_management_timeline_event.yml b/config/events/1669902189_IncidentManagement__TimelineEvents__DestroyService_incident_management_timeline_event.yml new file mode 100644 index 0000000000000000000000000000000000000000..a314f3c7b8e846c1374b491ab111dfe436a84d19 --- /dev/null +++ b/config/events/1669902189_IncidentManagement__TimelineEvents__DestroyService_incident_management_timeline_event.yml @@ -0,0 +1,26 @@ +--- +category: IncidentManagement::TimelineEvents::DestroyService +action: incident_management_timeline_event_deleted +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Event migrates from Service Ping metric. Count of unique users deleted timeline events" +product_section: ops +product_stage: monitor +product_group: respond +product_category: incident_management +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669902383_IncidentManagement__TimelineEvents__UpdateService_incident_management_timeline_event_.yml b/config/events/1669902383_IncidentManagement__TimelineEvents__UpdateService_incident_management_timeline_event_.yml new file mode 100644 index 0000000000000000000000000000000000000000..afab1a0f53176b36ff6d0c45eaf54dfcf39b5f4c --- /dev/null +++ b/config/events/1669902383_IncidentManagement__TimelineEvents__UpdateService_incident_management_timeline_event_.yml @@ -0,0 +1,26 @@ +--- +category: IncidentManagement::TimelineEvents::UpdateService +action: incident_management_timeline_event_edited +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Event migrated form Service Ping metric. Count of unique users edited timeline events" +product_section: ops +product_stage: monitor +product_group: respond +product_category: incident_management +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669902538_IssueLinks__CreateService_incident_management_incident_relate.yml b/config/events/1669902538_IssueLinks__CreateService_incident_management_incident_relate.yml new file mode 100644 index 0000000000000000000000000000000000000000..00ac75816178a38c32ab949485d1892645d4256e --- /dev/null +++ b/config/events/1669902538_IssueLinks__CreateService_incident_management_incident_relate.yml @@ -0,0 +1,26 @@ +--- +category: IssueLinks::CreateService +action: incident_management_incident_relate +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users adding issues per that are related to an incident. Migrated from Service Ping" +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669902705_IssueLinks__DestroyService_incident_management_incident_unrelate.yml b/config/events/1669902705_IssueLinks__DestroyService_incident_management_incident_unrelate.yml new file mode 100644 index 0000000000000000000000000000000000000000..4870e2b1f048aba31601ecb563068f67bb1d8bb2 --- /dev/null +++ b/config/events/1669902705_IssueLinks__DestroyService_incident_management_incident_unrelate.yml @@ -0,0 +1,26 @@ +--- +category: IssueLinks::DestroyService +action: incident_management_incident_unrelate +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +milestone: "15.7" +description: "Count of unique users removing issue that are related to an incident. Migrated from Service Ping metric" +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669902889_Issues__CloseService_incident_management_incident_closed.yml b/config/events/1669902889_Issues__CloseService_incident_management_incident_closed.yml new file mode 100644 index 0000000000000000000000000000000000000000..8e6f54876b2caf4e1d095ff0d9603e2f274622b7 --- /dev/null +++ b/config/events/1669902889_Issues__CloseService_incident_management_incident_closed.yml @@ -0,0 +1,26 @@ +--- +category: Issues::CloseService +action: incident_management_incident_closed +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of users closing incidents. Migrated from Service Ping metric." +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669903092_Issues__ReopenService_incident_management_incident_reopened.yml b/config/events/1669903092_Issues__ReopenService_incident_management_incident_reopened.yml new file mode 100644 index 0000000000000000000000000000000000000000..33118e110519da95e212874271b01737f9d31ad5 --- /dev/null +++ b/config/events/1669903092_Issues__ReopenService_incident_management_incident_reopened.yml @@ -0,0 +1,26 @@ +--- +category: Issues::ReopenService +action: incident_management_incident_reopened +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users reopening incidents. Migrated from Service Ping metric." +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669903273_Issues__UpdateService_incident_management_incident_change_confidential.yml b/config/events/1669903273_Issues__UpdateService_incident_management_incident_change_confidential.yml new file mode 100644 index 0000000000000000000000000000000000000000..2992667da31bc0b7daa1ce3bed4648ecdc1ba442 --- /dev/null +++ b/config/events/1669903273_Issues__UpdateService_incident_management_incident_change_confidential.yml @@ -0,0 +1,26 @@ +--- +category: Issues::UpdateService +action: incident_management_incident_change_confidential +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users changing incidents to confidential. Event migrated from Service Ping metric." +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669903414_Issues__ZoomLinkService_incident_management_incident_zoom_meeting.yml b/config/events/1669903414_Issues__ZoomLinkService_incident_management_incident_zoom_meeting.yml new file mode 100644 index 0000000000000000000000000000000000000000..5dc7506bc21971eba321eb5a1cbe55f5fb270bbb --- /dev/null +++ b/config/events/1669903414_Issues__ZoomLinkService_incident_management_incident_zoom_meeting.yml @@ -0,0 +1,26 @@ +--- +category: Issues::ZoomLinkService +action: incident_management_incident_zoom_meeting +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users creating Zoom meetings about incidents. Event migrated from Service Ping metric." +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669903530_Notes__CreateService_incident_management_incident_comment.yml b/config/events/1669903530_Notes__CreateService_incident_management_incident_comment.yml new file mode 100644 index 0000000000000000000000000000000000000000..f7b619e3277e616f88fd79c7ed67784e16308d6a --- /dev/null +++ b/config/events/1669903530_Notes__CreateService_incident_management_incident_comment.yml @@ -0,0 +1,26 @@ +--- +category: Notes::CreateService +action: incident_management_incident_comment +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users adding comments on incidents. Event migrated from Service Ping metric" +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1669903650_TodoService_incident_management_incident_todo.yml b/config/events/1669903650_TodoService_incident_management_incident_todo.yml new file mode 100644 index 0000000000000000000000000000000000000000..b8eee5ce23e743e98f8851c509aa470d667b0f3f --- /dev/null +++ b/config/events/1669903650_TodoService_incident_management_incident_todo.yml @@ -0,0 +1,26 @@ +--- +category: TodoService +action: incident_management_incident_todo +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +description: "Count of unique users adding incidents to the TODO list. Event migrated from Service Ping metric" +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/config/events/1670570965_Issues__UpdateService_incident_management_incident_assigned.yml b/config/events/1670570965_Issues__UpdateService_incident_management_incident_assigned.yml new file mode 100644 index 0000000000000000000000000000000000000000..22c1a41127b3e4fdb7cbcaf352a1968463a3ea14 --- /dev/null +++ b/config/events/1670570965_Issues__UpdateService_incident_management_incident_assigned.yml @@ -0,0 +1,26 @@ +--- +description: Count of unique users assiging incidents per +category: Issues::UpdateService +action: incident_management_incident_assigned +label_description: "Mirrored Service Ping total metric key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly" +property_description: +value_description: +extra_properties: +identifiers: +- project +- user +- namespace +product_section: ops +product_stage: monitor +product_group: monitor +product_category: +milestone: "15.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105223 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate + diff --git a/ee/app/services/ee/todo_service.rb b/ee/app/services/ee/todo_service.rb index 46bccbc9248d698f49a8fbeee68ed004279aff9e..4aa6e970e1ec2a4cd52fd35ace08319a3f08109b 100644 --- a/ee/app/services/ee/todo_service.rb +++ b/ee/app/services/ee/todo_service.rb @@ -54,7 +54,8 @@ def attributes_for_target(target) end def create_approval_required_todos(merge_request, approvers, author) - attributes = attributes_for_todo(merge_request.project, merge_request, author, ::Todo::APPROVAL_REQUIRED) + project = merge_request.project + attributes = attributes_for_todo(project, merge_request, author, ::Todo::APPROVAL_REQUIRED) # Preload project_authorizations to prevent n+1 queries merge_request.project.team.max_member_access_for_user_ids(approvers.map(&:id)) @@ -63,12 +64,13 @@ def create_approval_required_todos(merge_request, approvers, author) approver.can?(:approve_merge_request, merge_request) end - create_todos(approvers, attributes) + create_todos(approvers, attributes, project.namespace, project) end def create_merge_train_removed_todo(merge_request, user) - attributes = attributes_for_todo(merge_request.project, merge_request, user, ::Todo::MERGE_TRAIN_REMOVED) - create_todos(user, attributes) + project = merge_request.project + attributes = attributes_for_todo(project, merge_request, user, ::Todo::MERGE_TRAIN_REMOVED) + create_todos(user, attributes, project.namespace, project) end end end diff --git a/ee/app/services/status_page/publish_service.rb b/ee/app/services/status_page/publish_service.rb index ea3961d41ce8b45348906e99dd9b5a02ec3ee9b8..1864666cf32d8cdccb5eef6b589473a00681da3b 100644 --- a/ee/app/services/status_page/publish_service.rb +++ b/ee/app/services/status_page/publish_service.rb @@ -97,7 +97,23 @@ def error(message) end def track_event - track_usage_event(:incident_management_incident_published, user.id) unless should_unpublish? + return if should_unpublish? + + namespace = project.namespace + event = 'incident_management_incident_published' + track_usage_event(event, user.id) + + return unless Feature.enabled?(:route_hll_to_snowplow_phase2, namespace) + + Gitlab::Tracking.event( + self.class.to_s, + event, + project: project, + namespace: namespace, + user: user, + label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context] + ) end end end diff --git a/ee/spec/services/status_page/publish_service_spec.rb b/ee/spec/services/status_page/publish_service_spec.rb index 42edaacc3dd3ae493c410ac887c1e6c1882e2748..f1edf1b28533c644ce49ad1f421e4fddd0105d76 100644 --- a/ee/spec/services/status_page/publish_service_spec.rb +++ b/ee/spec/services/status_page/publish_service_spec.rb @@ -38,6 +38,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_published do let(:current_user) { user } end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_published' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end context 'when upload fails' do diff --git a/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb b/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb index 31abbabe3859e334a52d9d96088fa8e793736d13..125e15b70cf275fbf8ccff972b5ef20fb46958bb 100644 --- a/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb +++ b/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb @@ -56,6 +56,15 @@ context 'when operation mode is not specified' do it_behaves_like 'successful resolution' it_behaves_like 'an incident management tracked event', :incident_management_alert_assigned + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_alert_assigned' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end context 'when user does not have permission to update alerts' do diff --git a/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb b/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb index ea5e21ec4b8b0b6c2c1d3e54d0a0577bc7407704..bcb7c74fa09c6f5d532a07c5b27cd07471654f0a 100644 --- a/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb +++ b/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb @@ -19,6 +19,15 @@ it_behaves_like 'an incident management tracked event', :incident_management_alert_todo + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_alert_todo' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end + context 'when user does not have permissions' do let(:current_user) { nil } diff --git a/spec/graphql/mutations/alert_management/create_alert_issue_spec.rb b/spec/graphql/mutations/alert_management/create_alert_issue_spec.rb index 4758ac526a54ff3894e7b42e5691bc4bc005d54a..e49596b37c9ae2b48bb5d0fa8bed1d6567940839 100644 --- a/spec/graphql/mutations/alert_management/create_alert_issue_spec.rb +++ b/spec/graphql/mutations/alert_management/create_alert_issue_spec.rb @@ -30,6 +30,15 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_created it_behaves_like 'an incident management tracked event', :incident_management_alert_create_incident + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_incident_created' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end context 'when CreateAlertIssue responds with an error' do @@ -46,6 +55,15 @@ errors: ['An issue already exists'] ) end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_incident_created' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end end diff --git a/spec/graphql/mutations/alert_management/update_alert_status_spec.rb b/spec/graphql/mutations/alert_management/update_alert_status_spec.rb index 2c2518e046a672b64af633783e52cf5c59dc289a..22ad93df79b770f5cd894b87a7f3877776e9c126 100644 --- a/spec/graphql/mutations/alert_management/update_alert_status_spec.rb +++ b/spec/graphql/mutations/alert_management/update_alert_status_spec.rb @@ -35,6 +35,15 @@ let(:user) { current_user } end + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_alert_status_changed' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end + context 'error occurs when updating' do it 'returns the alert with errors' do # Stub an error on the alert diff --git a/spec/services/incident_management/timeline_events/create_service_spec.rb b/spec/services/incident_management/timeline_events/create_service_spec.rb index b10862a78b55e8d472aa9daf6b428129821e9177..a3810879c65c809f2cbab1b908b456629c8e1e36 100644 --- a/spec/services/incident_management/timeline_events/create_service_spec.rb +++ b/spec/services/incident_management/timeline_events/create_service_spec.rb @@ -55,6 +55,15 @@ end it_behaves_like 'an incident management tracked event', :incident_management_timeline_event_created + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_timeline_event_created' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end subject(:execute) { service.execute } @@ -276,6 +285,15 @@ it_behaves_like 'an incident management tracked event', :incident_management_timeline_event_created + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_timeline_event_created' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end + it 'successfully creates a database record', :aggregate_failures do expect { execute }.to change { ::IncidentManagement::TimelineEvent.count }.by(1) end diff --git a/spec/services/incident_management/timeline_events/destroy_service_spec.rb b/spec/services/incident_management/timeline_events/destroy_service_spec.rb index e1b258960ae7a1e530364585ecbad8533910f236..f90ff72a2bfb9cd0c5e028df6fe59330dd620b4d 100644 --- a/spec/services/incident_management/timeline_events/destroy_service_spec.rb +++ b/spec/services/incident_management/timeline_events/destroy_service_spec.rb @@ -65,6 +65,15 @@ end it_behaves_like 'an incident management tracked event', :incident_management_timeline_event_deleted + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:user) { current_user } + let(:action) { 'incident_management_timeline_event_deleted' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end end end diff --git a/spec/services/incident_management/timeline_events/update_service_spec.rb b/spec/services/incident_management/timeline_events/update_service_spec.rb index 8ccc6ded6d05e869e0c7bed84e3d8aa60c465a34..076ba05911431fedb936927dc0106b60e668c634 100644 --- a/spec/services/incident_management/timeline_events/update_service_spec.rb +++ b/spec/services/incident_management/timeline_events/update_service_spec.rb @@ -48,6 +48,14 @@ end it_behaves_like 'an incident management tracked event', :incident_management_timeline_event_edited + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace.reload } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_timeline_event_edited' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end shared_examples 'error response' do |message| diff --git a/spec/services/issue_links/create_service_spec.rb b/spec/services/issue_links/create_service_spec.rb index 9cb5980716a231de7829dba620acc31d6bc3e8b5..88e8470658d70958df8e3c2d37f11eb263bd6897 100644 --- a/spec/services/issue_links/create_service_spec.rb +++ b/spec/services/issue_links/create_service_spec.rb @@ -41,6 +41,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_relate do let(:current_user) { user } end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_relate' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end end end diff --git a/spec/services/issue_links/destroy_service_spec.rb b/spec/services/issue_links/destroy_service_spec.rb index a478a2c1448a82dbc13c8f20c2e0be29426909cf..ecb53b5cd31dd1f18f515361f3c62e1aeadfe57a 100644 --- a/spec/services/issue_links/destroy_service_spec.rb +++ b/spec/services/issue_links/destroy_service_spec.rb @@ -25,6 +25,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_unrelate do let(:current_user) { user } end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue_b.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_unrelate' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end end end diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index dcb17c95f3bb60bec3f70e313caace4f6e609ec6..8e5717090b44afa8a21b4e1c7ceb078bbba0a98c 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -99,6 +99,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_closed + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_closed' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end + it 'creates a new escalation resolved escalation status', :aggregate_failures do expect { service.execute(issue) }.to change { IncidentManagement::IssuableEscalationStatus.where(issue: issue).count }.by(1) diff --git a/spec/services/issues/reopen_service_spec.rb b/spec/services/issues/reopen_service_spec.rb index 6013826f9b1efd22b9f8c2851ebff4f28030c809..529b3ff266b7cf628a0891c1209faff8efac5442 100644 --- a/spec/services/issues/reopen_service_spec.rb +++ b/spec/services/issues/reopen_service_spec.rb @@ -74,6 +74,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_reopened + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_reopened' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end + it 'creates a timeline event' do expect(IncidentManagement::TimelineEvents::CreateService) .to receive(:reopen_incident) diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index f1ee62fd589b5c80226399436d9a58ce526ae2be..70fc6ffc38f2139a39a03d8a8a45574aafc76267 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -60,7 +60,7 @@ def update_issue(opts) description: 'Also please fix', assignee_ids: [user2.id], state_event: 'close', - label_ids: [label.id], + label_ids: [label&.id], due_date: Date.tomorrow, discussion_locked: true, severity: 'low', @@ -189,6 +189,27 @@ def update_issue(opts) subject { update_issue(confidential: true) } it_behaves_like 'an incident management tracked event', :incident_management_incident_change_confidential + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + let(:action) { 'incident_management_incident_change_confidential' } + let(:opts) do + { + title: 'New title', + description: 'Also please fix', + assignee_ids: [user2.id], + state_event: 'close', + due_date: Date.tomorrow, + discussion_locked: true, + severity: 'low', + milestone_id: milestone.id, + add_contacts: [contact.email] + } + end + end end end @@ -673,6 +694,14 @@ def update_issue(opts) let(:current_user) { user } it_behaves_like 'an incident management tracked event', :incident_management_incident_assigned + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + let(:action) { "incident_management_incident_assigned" } + end end end diff --git a/spec/services/issues/zoom_link_service_spec.rb b/spec/services/issues/zoom_link_service_spec.rb index d662d9fa9781bf58442d26c00c3f46a39c27e3a0..ad1f91ab5e629fd9be304d44018792ffc96d696d 100644 --- a/spec/services/issues/zoom_link_service_spec.rb +++ b/spec/services/issues/zoom_link_service_spec.rb @@ -95,6 +95,14 @@ let(:current_user) { user } it_behaves_like 'an incident management tracked event', :incident_management_incident_zoom_meeting + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_zoom_meeting' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end context 'with insufficient issue update permissions' do diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index 4922e72b7a46867cb583d4a88001edb535af7eb6..2f1c5a5b0f3a2fc6aa85a66a440acdfca78d7a35 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -102,6 +102,14 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_comment do let(:current_user) { user } end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { issue.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_comment' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + end end describe 'event tracking', :snowplow do diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb index 56440d7b5f5c2ef3ad2ad84ccbe772c6f9ebac54..c4ed34a693e6d54a04e788d6951c3b3da149598d 100644 --- a/spec/services/todo_service_spec.rb +++ b/spec/services/todo_service_spec.rb @@ -209,6 +209,15 @@ it_behaves_like 'an incident management tracked event', :incident_management_incident_todo do let(:current_user) { john_doe } end + + it_behaves_like 'Snowplow event tracking with RedisHLL context' do + let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } + let(:namespace) { project.namespace } + let(:category) { described_class.to_s } + let(:action) { 'incident_management_incident_todo' } + let(:label) { 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly' } + let(:user) { john_doe } + end end end @@ -1251,6 +1260,19 @@ end describe '#create_member_access_request' do + context 'snowplow event tracking' do + it 'does not track snowplow event when todos are for access request for project', :snowplow do + user = create(:user) + project = create(:project) + requester = create(:project_member, project: project, user: assignee) + project.add_owner(user) + + expect_no_snowplow_event + + service.create_member_access_request(requester) + end + end + context 'when the group has more than 10 owners' do it 'creates todos for 10 recently active group owners' do group = create(:group, :public)