steampipe-plugin-gitlab icon indicating copy to clipboard operation
steampipe-plugin-gitlab copied to clipboard

Project query displays 'null' for statistics

Open someclouddude opened this issue 1 year ago • 1 comments

When performing a query on project to get statistics all columns are null. However, when setting statistics=true on an API call to the same project id the expected results are returned. I looked and there are references to statistics where stats = true in the project. I don't see a connection option.

GitlabEE self hosted version 16.9.5-ee.

Example Steampipe query: select id,name,repository_size,storage_size, lfs_objects_size from gitlab_project where id = 4766

+------+--------+-----------------+--------------+------------------+
| id   | name   | repository_size | storage_size | lfs_objects_size |
+------+--------+-----------------+--------------+------------------+
| 4766 | 24reen | <null>          | <null>       | <null>           |
+------+--------+-----------------+--------------+------------------+

curl ... "https://gitlab..../api/v4/projects/4766?statistics=true" | jq | grep size "storage_size": 12271071469, "repository_size": 668659, "wiki_size": 0, "lfs_objects_size": 12270402810, "job_artifacts_size": 0, "pipeline_artifacts_size": 0, "packages_size": 0, "snippets_size": 0, "uploads_size": 0

If someone has the time, it would be awesome if you could take a look.

someclouddude avatar May 03 '24 13:05 someclouddude

Maybe the output has changed, looks like the transform for 'commit_count' is

{
...
			Transform:   transform.FromField("Statistics.CommitCount"),
		},

the Transform for the different sizes looks to include an additional level

		{
			Name:        "storage_size",
			Type:        proto.ColumnType_INT,
			Description: "The size of the project on disk.",
			Transform:   transform.FromField("Statistics.StorageStatistics.StorageSize"),
		},

However, from the api output it's all just "statistics"

 "issue_branch_template": null,
 "statistics": {
   "commit_count": 58,
   "storage_size": 12271071469,
   "repository_size": 668659,
   "wiki_size": 0,
   "lfs_objects_size": 12270402810,
   "job_artifacts_size": 0,
   "pipeline_artifacts_size": 0,
   "packages_size": 0,
   "snippets_size": 0,
   "uploads_size": 0
 },

someclouddude avatar May 03 '24 14:05 someclouddude

Yup, you're correct - the underlying SDK changed the struct.

Thanks for pointing it out, fix will be in next release.

graza-io avatar Jun 19 '24 09:06 graza-io