Skip to content

Add Google Cloud IAM integration metrics to Service Ping

Andrew Evans requested to merge 456104-instrument-gcp-iam-integration into master

What does this MR do and why?

Add Google Cloud IAM integration metrics to Service Ping

Many metrics exist for integrations, but right now we are not tracking them for Google Cloud IAM integration because we lack the metric definition files for them. This adds definition files for some of the GCP IAM integration metrics, to help us track the success of this feature.

This MR is modeled directly off of !148414 (merged)

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.

How to set up and validate locally

Execute the following commands in the rails console, while emultating SaaS:

GITLAB_SIMULATE_SAAS=1 bin/rails console

  1. Verify the integration Google Artifact Registry google_cloud_platform_workload_identity_federation is listed among the available integrations

    Integration.available_integration_names(include_dev: false, include_disabled: true)
  2. Verify that the metric returns 0

    spr = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: false) ; spr['counts']['projects_google_cloud_platform_workload_identity_federation_active']

    The counter should return 0

  3. Create a new Google Artifact Registry integration

    FactoryBot.create(:google_cloud_platform_artifact_registry_integration)
  4. Verify that the metric is updated

    Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: false)['counts']['projects_google_cloud_platform_workload_identity_federation_active']

    The counter should return 1

  5. Check the same for the group_ count:

    spr['counts']['groups_google_cloud_platform_workload_identity_federation_active'] # should eq 0
    
    group = Group.last
    FactoryBot.create(:google_cloud_platform_artifact_registry_integration, project: nil, group: group)
    
    spr = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: false)
    spr['counts']['groups_google_cloud_platform_workload_identity_federation_active']

Related to #456104 (closed)

Edited by Andrew Evans

Merge request reports