Terraform module download statistics
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Implement Time-based Download Analytics for Terraform Modules
Overview
We need to implement a feature that allows users to track how many times a Terraform module has been downloaded over time. This analytics capability will help customers identify usage patterns and identify candidates for potential retirement.
Problem Statement
Currently, users lack visibility into how frequently their Terraform modules are being downloaded and used. Without this data, it's difficult to make informed decisions about which modules to maintain, update, or retire. Teams need download metrics to understand module adoption and usage trends across their organization.
User Stories
- As a DevOps manager, I want to see download counts for Terraform modules so I can identify which modules are most valuable to our organization.
- As an infrastructure architect, I want to track module usage over time so I can identify declining usage patterns that might indicate a module is becoming obsolete.
- As a platform engineer, I want to understand which module versions are most frequently downloaded so I can prioritize maintenance efforts.
- As a team lead, I want to identify underutilized modules so I can make data-driven decisions about module retirement.
Requirements
Functional Requirements
- Display download count for each Terraform module
- Show total all-time downloads
- Show downloads by version
- Update counts in near real-time (within 5 minutes of download)
 
- Allow filtering by time period
- Preset filters: last 7 days, last 30 days, last quarter, last year
- Custom date range selection
 
- Implement graphical representation of download trends
- Line charts showing downloads over time
- Bar charts comparing downloads across different modules
- Heat maps showing download frequency by time period
 
- Integrate with GitLab's analytics dashboards
- Add Terraform module downloads as a data source in project analytics
- Allow for inclusion in custom dashboards
- Export functionality for reports (CSV, JSON)
 
Non-Functional Requirements
- Performance: Analytics queries should complete in < 3 seconds
- Scalability: System should handle repositories with thousands of modules
- Data retention: Download statistics should be retained for at least 2 years
- Minimal impact on download performance
Technical Considerations
- Evaluate existing analytics tracking infrastructure for reuse
- Consider implementing a background job to process download events
- Assess data storage requirements for long-term metrics
- Evaluate impact on database performance
- Consider rate limiting or sampling for very high-volume repositories
Implementation Approach
- Add event tracking for module downloads
- Store download events with timestamps and relevant metadata
- Create aggregation logic for various time periods
- Implement UI components for data visualization
- Integrate with existing analytics dashboard framework
Success Criteria
- Users can view accurate download counts for all modules
- Time-based filtering accurately reflects download activity in the selected period
- Graphical representations properly visualize trends
- Analytics data is available through GitLab's analytics dashboard
- System remains performant even with high download volumes
Edited  by 🤖 GitLab Bot 🤖