Skip to content

CI/CD Analytics: Modify VSA summary metrics API to include id/type for each metric

Problem to solve

Currently, the Value Stream Analytics (VSA) summary endpoint returns all metrics in one request. On the CI/CD Analytics page, we want to reuse that API call and show only the deployment count and deployment frequency metrics. However, the returned metrics don't really have an id/type attribute for each metric. They each have a human-readable title attribute, but it would be bad practice for the frontend to attempt to use that to identify the type of metric, because title (and translations) can change over time. Frontend needs a non-changing id/type attribute to rely on.

Proposal

Extend the metric serializer (used in Gitlab::CycleAnalytics::StageSummary and Gitlab::Analytics::CycleAnalytics::Summary::Group::StageSummary) to expose a new attribute identifier. This attribute will uniquely identify a metric. For example, the metric with title "Deployment Frequency" would have the identifier "deployment_frequency".

Out of scope

To avoid loading unnecessary metrics, the API should accept filters where we can specify which metrics to return:

1.. Extend the project and group level summary_controller to accept a new filter param: identifiers (comma separated list)

  1. Update the Summary classes to query only the requested identifiers
Edited by Dan Jensen