Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding metrics for recipe grabage collection and refactoring engine t…
…o take options. (#6232) # Description - Added RecipeEngineOperationGC metric for recipe garbage collection operation - Refactored code to take options for execute and delete functions in Engine. ## Type of change <!-- Please select **one** of the following options that describes your change and delete the others. Clearly identifying the type of change you are making will help us review your PR faster, and is used in authoring release notes. If you are making a bug fix or functionality change to Radius and do not have an associated issue link please create one now. --> - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). <!-- Please update the following to link the associated issue. This is required for some kinds of changes (see above). --> https://github.com/radius-project/radius/issues/4446 ## Auto-generated summary <!-- GitHub Copilot for docs will auto-generate a summary of the PR --> <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 59d506c</samp> ### Summary 🧹🛠️📊 <!-- 1. 🧹 - This emoji represents the recipe garbage collection feature, which cleans up unused recipes from the database. It conveys the idea of tidying up and removing clutter. 2. 🛠️ - This emoji represents the refactoring of the engine interface and the test code, which improves the readability and simplicity of the code. It conveys the idea of fixing and improving something. 3. 📊 - This emoji represents the observability of the recipe garbage collection process, which records its duration as a metric. It conveys the idea of measuring and analyzing something. --> This pull request refactors the engine package and its consumers to use options structs for the Execute and Delete methods, simplifying the interface and improving readability. It also adds metrics for the recipe garbage collection duration in the bicep driver. > _We're refactoring the engine code, me hearties_ > _Using options structs for Execute and Delete_ > _It makes the code more readable and tidy_ > _So heave away on the count of three_ ### Walkthrough * Add metrics for recipe garbage collection duration ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-6403665d6373b7e2a29e5a0e1d8e52b830982dfdce21983cfd83e1c434b19046R37-R39), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-6403665d6373b7e2a29e5a0e1d8e52b830982dfdce21983cfd83e1c434b19046R54-R56), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-6403665d6373b7e2a29e5a0e1d8e52b830982dfdce21983cfd83e1c434b19046R132-R139), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0R146), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L151-R157)) * Refactor engine methods to use options structs instead of separate parameters ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-88040b9959d0c406cb8ed95caa785345085b114078658de636164a546f910749L134-R139), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-b5a5c7f766f17b812eb1e5bd1815303ade4f0486d243708a526832a65bbed011L336-R351), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-c6fc204032902b38f97dc71fe64ce145d1f851419f4eef7682a2d62183172a03L89-R94), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f717af7a7bcb5381570a73610840036355990198ea4dc08b2c49f787c1ee09abL124-R129), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L51-R55), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L61-R61), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L96-R100), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L106-R106), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L115-R120), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L173-R183), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L243-R258), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L274-R294), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L298-R324), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L330-R362), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L375-R412), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L421-R463), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L436-R483), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L450-R502), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L40-R41), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L48-R55), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L63-R64), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-11be7ca47327363d5edeaff3c6ac6389a462ff9111e1fc03ccb3a98123cd939fL31-R59)) * Define `ExecuteOptions` and `DeleteOptions` structs in `engine/types.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-11be7ca47327363d5edeaff3c6ac6389a462ff9111e1fc03ccb3a98123cd939fL31-R59)) * Update `Engine` interface to use options structs in `engine/types.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-11be7ca47327363d5edeaff3c6ac6389a462ff9111e1fc03ccb3a98123cd939fL31-R59)) * Update `MockEngine` and `MockEngineMockRecorder` to use options structs in `mock_engine.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L40-R41), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L48-R55), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L63-R64)) * Update `engine.Execute` and `engine.Delete` methods to use options structs in `engine.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L51-R55), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L61-R61), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L96-R100), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-06702c6df95f9efe532b70614e1341244f575e5cbc030db57af268ecbfcd8c59L106-R106)) * Update `bicep.Execute` method to use options structs in `driver/bicep.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0R146), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L151-R157)) * Update `createorupdateresource.executeRecipeIfNeeded` and `deleteresource.Run` methods to use options structs in `controller/createorupdateresource.go` and `controller/deleteresource.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-88040b9959d0c406cb8ed95caa785345085b114078658de636164a546f910749L134-R139), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-c6fc204032902b38f97dc71fe64ce145d1f851419f4eef7682a2d62183172a03L89-R94)) * Update engine tests to use options structs in `engine_test.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L115-R120), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L173-R183), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L243-R258), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L274-R294), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L298-R324), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L330-R362), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L375-R412), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L421-R463), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L436-R483), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-3fdb9931c1f2ddfc5b14d87f47b4124f2bdc1da187219fa1ad9cbe79fc326528L450-R502)) * Update controller tests to use options structs in `createorupdateresource_test.go` and `deleteresource_test.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-b5a5c7f766f17b812eb1e5bd1815303ade4f0486d243708a526832a65bbed011L336-R351), [link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-f717af7a7bcb5381570a73610840036355990198ea4dc08b2c49f787c1ee09abL124-R129)) * Remove unused import from `mock_engine.go` ([link](https://github.com/radius-project/radius/pull/6232/files?diff=unified&w=0#diff-2dee9fa8b594b7a0e0783bd6587b452223eb5f7ba7c28a1dc0178c121a2509f0L13))
- Loading branch information