Skip to content

V2 resource apis - #919

Draft
wagnerd3 wants to merge 10 commits into
masterfrom
v2_resource_apis
Draft

V2 resource apis#919
wagnerd3 wants to merge 10 commits into
masterfrom
v2_resource_apis

Conversation

@wagnerd3

Copy link
Copy Markdown
Contributor

Current state:

  • I introduced some simplifications compared to /rates, e.g. direct access to entities by ID from ServiceInfoCache
  • all apis implemented, tests written
  • I think that It can serve all data as we imagined when brainstorming a few months ago and that all ?with= options exist that we needed
  • the performance is as follows: /resources/v2/project with our largest domain in our largest region is 10s computation, with all projects of the region it's 30s computation. That's not great, but acceptable, considering that in v1 the iteration through all domains produces some overhead that we save in v2
  • my main idea was to have 1 SQL result per innermost result object so that we don't have to loop over the result multiple times - this makes the SQL quite long, possibly it could be shortened through clever application of theory of sets?

TODO:

  • look at streaming the results of resources/v2/project, because this is quite a large data amount. the streaming implementation of v1 only works with list currently, not with object, but we can most likely make this work
  • please look at the oslo policy, whether that is how we want to check for special with-flags in resources/v2/project
  • check that I did not forget any functionality (params, returned data)
  • probably, some logic can be deduplicated when looking at it long enough. E.g. the setIn...Report functions have a lot of duplication. Maybe we should implement a generic func Set(value any) on all structs and do this recursive? That does not help for values which are set on a higher level in the structure though, like scraped_at, forbid_autogrowth, max_quota, ......
  • look at SQL for optimization potential

@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/sapcc/limes/internal/api/api_v2 87.65% (+15.35%) 🎉
github.com/sapcc/limes/internal/api/reports_v2 91.64% (+0.22%) 👍
github.com/sapcc/limes/internal/apideclarations/apiv2/common 0.00% (ø)
github.com/sapcc/limes/internal/apideclarations/apiv2/resources 0.00% (ø)
github.com/sapcc/limes/internal/core 82.19% (+1.29%) 👍
github.com/sapcc/limes/internal/test 93.58% (+0.10%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/limes/internal/api/api_v2/cluster.go 80.00% (+35.56%) 240 (+24) 192 (+96) 48 (-72) 🌟
github.com/sapcc/limes/internal/api/api_v2/domain.go 85.71% (+50.42%) 336 (-72) 288 (+144) 48 (-216) 🌟
github.com/sapcc/limes/internal/api/api_v2/project.go 88.89% (+53.59%) 432 (+24) 384 (+240) 48 (-216) 🌟
github.com/sapcc/limes/internal/api/reports_v2/cluster.go 90.65% (-0.84%) 856 (+480) 776 (+432) 80 (+48) 👎
github.com/sapcc/limes/internal/api/reports_v2/domain.go 90.74% (-1.42%) 864 (+456) 784 (+408) 80 (+48) 👎
github.com/sapcc/limes/internal/api/reports_v2/extra_props.go 100.00% (+100.00%) 216 (+216) 216 (+216) 0 🌟
github.com/sapcc/limes/internal/api/reports_v2/filter.go 84.62% (+1.56%) 520 (+48) 440 (+48) 80 👍
github.com/sapcc/limes/internal/api/reports_v2/project.go 92.37% (-0.49%) 1048 (+600) 968 (+552) 80 (+48) 👎
github.com/sapcc/limes/internal/api/reports_v2/scope.go 90.00% (ø) 480 432 48
github.com/sapcc/limes/internal/apideclarations/apiv2/common/opts.go 0.00% (ø) 0 0 0
github.com/sapcc/limes/internal/apideclarations/apiv2/resources/cluster.go 0.00% (ø) 0 0 0
github.com/sapcc/limes/internal/apideclarations/apiv2/resources/domain.go 0.00% (ø) 0 0 0
github.com/sapcc/limes/internal/apideclarations/apiv2/resources/project.go 0.00% (ø) 0 0 0
github.com/sapcc/limes/internal/core/service_info_cache.go 90.30% (+4.46%) 2144 (+336) 1936 (+384) 208 (-48) 👍
github.com/sapcc/limes/internal/test/mock_enforcer.go 93.33% (+0.74%) 240 (+24) 224 (+24) 16 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/sapcc/limes/internal/api/api_v2/cluster_test.go
  • github.com/sapcc/limes/internal/api/api_v2/domain_test.go
  • github.com/sapcc/limes/internal/api/api_v2/project_test.go
  • github.com/sapcc/limes/internal/api/reports_v2/extra_props_test.go
  • github.com/sapcc/limes/internal/api/reports_v2/scope_test.go
  • github.com/sapcc/limes/internal/core/service_info_cache_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants