Metrics: Add metrics for Source branch pattern exceptions for MR Approval Policies
Overview
This issue covers implementing simple usage metrics to track adoption of the Source branch pattern exceptions feature for merge request approval policies across GitLab Ultimate instances.
Scope: GitLab Ultimate tier only
Feature Summary
Track basic usage statistics for the new source branch pattern exceptions capability that allows organizations to define branch-based exceptions in merge request approval policies.
Metrics to Implement
1. Adoption Metrics
-
Projects with branch pattern exceptions: Count of projects that have configured at least one source branch pattern exception -
Groups with branch pattern exceptions: Count of groups that have configured source branch pattern exceptions in their approval policies -
Total pattern exceptions configured: Total number of branch pattern exceptions across all projects/groups
2. Usage Pattern Metrics
-
Most common branch patterns: Track frequency of pattern types (e.g., release/*,hotfix/*,develop) -
Exceptions triggered: Count of merge requests where branch pattern exceptions were applied -
Exception effectiveness: Ratio of MRs that would have been blocked vs. those that proceeded due to exceptions
3. Configuration Metrics
-
Approval policies with exceptions: Count of approval policies that include branch pattern exceptions -
Average patterns per policy: Average number of branch patterns configured per approval policy -
Configuration method tracking: Split between UI-configured vs API-configured exceptions
Implementation Requirements
1. Data Collection Points
-
Track when branch pattern exceptions are added/removed from approval policies -
Record when exceptions are triggered during merge request evaluation -
Log pattern matching events for usage analysis
2. Metric Storage
-
Implement counters for project-level adoption -
Implement counters for group-level adoption -
Store aggregated usage statistics for reporting
3. Reporting Integration
-
Add metrics to existing GitLab usage ping data -
Include in admin area usage statistics -
Provide basic dashboard view for instance administrators
Acceptance Criteria
- Metrics accurately count projects and groups using branch pattern exceptions
- Usage ping includes new metrics for GitLab product analytics
- Admin dashboard displays adoption statistics
- Metrics collection has minimal performance impact
- Data collection respects privacy settings and opt-out preferences
Deliverables
- Metrics implementation with proper instrumentation
- Usage ping integration for product analytics
- Admin dashboard updates showing adoption statistics
- Documentation for new metrics and their meanings
- Performance validation ensuring minimal overhead
Success Metrics
- Accurate tracking of feature adoption across Ultimate instances
- Clear visibility into usage patterns for product decision-making
- Minimal performance impact (< 1ms overhead per MR evaluation)
Edited by 🤖 GitLab Bot 🤖