Commit graph

5 commits

Author SHA1 Message Date
Alessio Caiazza
606a1d2d31 Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one

{
  namespace(fullPath: "a_namespace_path") {
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      packagesSize
      wikiSize
    }
  }
}
2019-08-22 22:08:28 +00:00
Mayra Cabrera
52767ae18d Hardcodes namespaces lease timing value to 1.5h
After measuring the response and performance of the workers on
https://gitlab.com/gitlab-org/gitlab-ce/issues/64092, we've decided 1.5
is fine for now. The time can be decreased later in the future when
enforcing the quota limits

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/64092
2019-08-01 15:27:12 +00:00
Mayra Cabrera
d132f73d42 Implements lease_release on NamespaceAggregation
Sets lease_release? to false to prevent the job to be re-executed more
often than lease timeout

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64079
2019-07-04 15:52:02 +00:00
Mayra Cabrera
dfdfa913ba Includes logic to persist namespace statistics
- Add two new ActiveRecord models:
  - RootNamespaceStoragestatistics will persist root namespace statistics
  - NamespaceAggregationSchedule will save information when a new update
to the namespace statistics needs to be scheduled
- Inject into UpdateProjectStatistics concern a new callback that will
call an async job to insert a new row onto NamespaceAggregationSchedule
table
- When a new row is inserted a new job is scheduled. This job will
update call an specific service to update the statistics and after that
it will delete thee aggregated scheduled row
- The RefresherServices makes heavy use of arel to build composable
queries to update Namespace::RootStorageStatistics attributes.
- Add an extra worker to traverse pending rows on
NAmespace::AggregationSchedule table and schedule a worker for each one
of this rows.
- Add an extra worker to traverse pending rows on
NAmespace::AggregationSchedule table and schedule a worker for each one
of this rows
2019-07-02 14:44:39 +00:00
Mayra Cabrera
bde41ee866 Add two new ActiveRecord models
- Namespace::Storagestatistics will persist root namespace statistics
- Namespace::AggregationSchedule will save information when a new update
to the namespace statistics needs to be scheduled

Both tables use 'namespace_id' as primary key
2019-06-25 09:54:47 -05:00