Skip to content

Adds duo workflow events and metrics

Surabhi Suman requested to merge 471299-workflow-usage-data into master

What does this MR do and why?

This adds workflow internal events and monthly usage metrics for duo_workflow

start_duo_workflow_execution

finish_duo_workflow_execution

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Follow the steps here for local GDK setup to view analytics events.

  2. Send an event using rails console

    include Gitlab::InternalEventsTracking
    
    track_internal_event(
      "start_duo_workflow_execution",
      user: User.find(1),
      additional_properties: {
        workflow_id: 1
      }
    )
  3. You can also send the event with ai_workflows scoped token via REST api.

    POST /api/v4/usage_data/track_event
    Host: GDK_HOST
    Content-Type: application/json
    
    {
        "event": "start_duo_workflow_execution",
        "additional_properties": {
            "workflow_id": 1
        }
    }
  4. Checkout you preferred testing tool to see the events. Note that if you use REST api, it doesn't appear in snowplow micro UI [[http://localhost:9091/micro/ui\](http://localhost:9091/micro/ui)](http://localhost:9091/micro/ui%5D(http://localhost:9091/micro/ui)) by default. You'll need to set send_snowplow_event to true.

  5. To check metrics like total workflow executions and total workflow executions per distinct user

    require_relative 'spec/support/helpers/service_ping_helpers.rb'
    
    ServicePingHelpers.get_current_usage_metric_value("counts.count_total_start_duo_workflow_execution_monthly") # total number of workflow start events
    ServicePingHelpers.get_current_usage_metric_value("redis_hll_counters.count_distinct_user_id_from_start_duo_workflow_execution_monthly") # total number of workflows per distinct user

Related to #471299 (closed)

Edited by Surabhi Suman

Merge request reports

Loading