OS Core Lib Azure merge requestshttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests2023-08-18T12:43:57Zhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/152fix fossa NOTICE to get latest rc package2023-08-18T12:43:57ZNeelesh Thakurfix fossa NOTICE to get latest rc packageM9 - Release 0.12https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/150too many cosmosdb request exception handler2023-08-18T12:43:59ZNeelesh Thakurtoo many cosmosdb request exception handlerM9 - Release 0.12https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/149Added @Configuration2023-08-18T12:44:00ZRonak SakhujaAdded @ConfigurationSpring doesn't create bean if @Configuration is not present. Hence adding @Configuration to config classSpring doesn't create bean if @Configuration is not present. Hence adding @Configuration to config classM9 - Release 0.12https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/148Update NOTICE2023-08-18T12:44:02ZAbhishek PatilUpdate NOTICEM9 - Release 0.12Abhishek PatilAbhishek Patilhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/147Remove unused dependencies2023-08-18T12:44:04ZRonak SakhujaRemove unused dependenciesM9 - Release 0.12https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/145Quality Improvements Publisher Facade2023-08-18T12:44:05ZNikhil Singh[MicroSoft]Quality Improvements Publisher Facade**INTRODUCTION**
This MR inculdes following quality improvements items:
1. Usage of builder patterns for amps and json objects
1. Removal of conditional beans as some services (ex schema) can have both EG and SB disabled.
1. Unit Tests u...**INTRODUCTION**
This MR inculdes following quality improvements items:
1. Usage of builder patterns for amps and json objects
1. Removal of conditional beans as some services (ex schema) can have both EG and SB disabled.
1. Unit Tests updatedM9 - Release 0.12Nikhil Singh[MicroSoft]Nikhil Singh[MicroSoft]https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/143Publisher Facade2023-08-18T12:44:07ZNikhil Singh[MicroSoft]Publisher Facade## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] Does the MR contain pipeline/ helm chart related changes?
* [NA] I have u...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] Does the MR contain pipeline/ helm chart related changes?
* [NA] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [NA] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
This MR introduces a publisher facade which can be used across services in order to publish messages to message brokers(Service Bus/ Event Grid).It will help to manage and update at a single source instead of each service doing it individually.The pub sub configuration can be used to configure publishing for Event grid and Service bus.
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
- All existing and new TC's passed.
## Does this introduce a breaking change?
-------------------------------------
- [NO]M9 - Release 0.12Nikhil Singh[MicroSoft]Nikhil Singh[MicroSoft]https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/142Circuitbreaker configuration being configurable through application.properties2023-08-18T12:44:09ZRonak SakhujaCircuitbreaker configuration being configurable through application.properties## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [YES] I have added tests...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [YES] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
Circuit Breaker can be made configurable through adding a CircuitBreakerConfig class to the registry. We are adding few boolean flags to the configuration to set those properties in circuitbreaker.
azure.circuitbreaker.enable = false;
azure.circuitbreaker.defaultCircuitBreaker = false;
azure.circuitbreaker.slidingWindowSize = 50;
azure.circuitbreaker.minimumNumberOfCalls = 50;
azure.circuitbreaker.failureRate = 50;
azure.circuitbreaker.slidingWindowType = "TIME_BASED";
azure.circuitbreaker.permittedCallsInHalfOpenState = 10;
Details about each is in Readme.
We are using postConstruct in setCBR method, to run that after initializing all values of configuration.
High level design:
Issue: <!-- Link any __GitLab__ workitem(s) to this pull request. -->
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
All tests are passing and changes are covered.
## Does this introduce a breaking change?
-------------------------------------
- [YES/NO]
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
No
## Pending items
----------------
<!-- Are there changes that you'll introduce in upcoming MRs and hence did not add in this one? Next steps of your
feature can also be mentioned here. -->
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->M9 - Release 0.12https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/141Updating OSDU dependencies to latest release2021-08-28T08:56:29ZDavid Diederichd.diederich@opengroup.orgUpdating OSDU dependencies to latest releaseM8 - Release 0.11David Diederichd.diederich@opengroup.orgDavid Diederichd.diederich@opengroup.orghttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/140Added LegalFactoryAzure and LegalAPIConfigBean2023-08-18T12:44:10ZMuskan SrivastavaAdded LegalFactoryAzure and LegalAPIConfigBean## All Submissions:
-------------------------------------
* I have added an explanation of what changes in this merge do and why we should include it? - YES
* Does the MR contain pipeline/ helm chart related changes?- NO
* I have updated...## All Submissions:
-------------------------------------
* I have added an explanation of what changes in this merge do and why we should include it? - YES
* Does the MR contain pipeline/ helm chart related changes?- NO
* I have updated the documentation accordingly. - NO
* I have added tests to cover my changes. -NA
* All new and existing tests passed. -YES
* My code follows the code style of this project. -YES
* I ran lint checks locally prior to submission. -YES
## What is the issue or story related to the change?
-------------------------------------
This change is a step forward to enable the services to configure following variables for service-to-service communication:
- Circuit Breaker
- Retry count for service unavailable strategy
- Connect timeout
- Connection Request Timeout
- Socket Timeout
<br>
All the above features are handled by HttpClientAzure class.
This MR essentially enables use of HttpClientAzure for legal service.
These configurations can be used for legal service now.
<br>
High level design: This MR adds 2 classes in total. <br>
- LegalAPIConfigAzure : creates a bean of type LegalAPIConfig
- LegalFactoryAzure : uses newly created HttpClientAzure internally so that configurable retires, CB and timeouts can be used for Legal Service.
## Does this introduce a breaking change?
-------------------------------------
- NO
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Tests and Results
To test the CB and timeouts, I used the scenario where storage service calls legal service. Simulations were triggered by Firefly Flight
1. Circuit Breaker: To test this legal service was killed. Result is as follows![Screenshot__29_](/uploads/b3398d97c9b06a574209eeddf28d3231/Screenshot__29_.png)
2. Timeouts: To test this Socket Timeouts was configured to be 40 sec for any calls made to legal service. Latency was induced to legal service between the range of 45 sec and 50 sec.
![Screenshot__30_](/uploads/66d4191433187731e39be420c98fea5a/Screenshot__30_.png)M9 - Release 0.12Muskan SrivastavaMuskan Srivastavahttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/138Token generation based on pod identity2023-08-18T12:44:12ZAbhishek PatilToken generation based on pod identity## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [NA] I have added tests ...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [NA] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [NO] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
High level design:
Issue: <!-- Link any __GitLab__ workitem(s) to this pull request. -->
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
Added logic to generate token using managed identity credentials.
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
## Does this introduce a breaking change?
-------------------------------------
- [NO]
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Pending items
----------------
<!-- Are there changes that you'll introduce in upcoming MRs and hence did not add in this one? Next steps of your
feature can also be mentioned here. -->
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->
Tested these changes with storage service.M8 - Release 0.11Abhishek PatilAbhishek Patilhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/137Modified the code to add Content-Type and Content-Disposition headers in sign...2023-08-18T12:44:14Zsachin GuptaModified the code to add Content-Type and Content-Disposition headers in signed URL generation logicIssue #https://community.opengroup.org/osdu/platform/system/file/-/issues/35Issue #https://community.opengroup.org/osdu/platform/system/file/-/issues/35M9 - Release 0.12Paresh BehedeParesh Behedehttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/134Management Client Service Bus2023-08-18T12:44:16ZNikhil Singh[MicroSoft]Management Client Service Bus## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] Does the MR contain pipeline/ helm chart related changes?
* [NO] I have u...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] Does the MR contain pipeline/ helm chart related changes?
* [NO] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [NA] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
ManagementClientFactoryImpl provides the management client for Service Bus by using the data partition ID.
A cache has been implemented for easy retrieval of same after its creation.
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
- All existing and new TC's passed.
## Does this introduce a breaking change?
-------------------------------------
- [NO]M8 - Release 0.11Nikhil Singh[MicroSoft]Nikhil Singh[MicroSoft]https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/133Fix NOTICE file issue2023-08-18T12:44:18ZAlok JoshiFix NOTICE file issueNo code change, updating NOTICE file to fix build issueNo code change, updating NOTICE file to fix build issueM8 - Release 0.11Alok JoshiAlok Joshihttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/132Updating Factory Implementations for Client generation using Key vault Creden...2023-08-18T12:44:19Zharshit aggarwalUpdating Factory Implementations for Client generation using Key vault Credentials## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [YES] I have added tests...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [YES] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
Currently we are using MSI to connect with Azure Resources in Data Partition, which requires appropriate role assignments of Service Principal and Managed Identities over the respective Azure resources
As of now the [DefaultAzureCredential ](https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/blob/master/src/main/java/org/opengroup/osdu/azure/dependencies/AzureOSDUConfig.java#L58) class is getting used to generate AD Tokens for Authenticating to Azure Resources
This change is updating Factory Implementations for Client Generation using KeyVault Credentials
Storage Account Blob Clients & Service Bus Topic Clients are getting initialized using DefaultAzureCredential and corresponding implementation using Keyvault Credentials is introduced in the change
The change is under feature flag and can be controlled via the property `azure.msi.isEnabled`
- By default the existing set up of MSI will continue to work as `matchIfMissing` property is set to `true`
- This property has to be set to `false` to use the clients using KeyVault Credentials
- Services willing to use clients with KeyVault Credentials should set `azure.msi.isEnabled=false` in application.properties
**The change has been tested by including this version of core-lib-azure in Schema, Storage & WKS service locally**
## Test coverage:
------------------
## Does this introduce a breaking change?
-------------------------------------
- [NO]
## Pending items
----------------
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------M8 - Release 0.11harshit aggarwalharshit aggarwalhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/131KV throttling issue - improve caching2023-08-18T12:44:22ZAlok JoshiKV throttling issue - improve caching## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NA] I have updated the documentation accordingly.
* [YES] I have added tests ...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NA] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [YES] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
Issue: If the system is under moderate/heavy load, we are seeing a lot of issues with Storage service because of KV throttling. The error we see is:
`storage.app Status code 429, "{"error":{"code":"Throttled","message":"Request was not processed because too many requests were received. Reason: VaultOperationLimitReached"}}"`
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
To address this, we can follow the [kv-throttling](https://docs.microsoft.com/en-us/azure/key-vault/general/overview-throttling) guideline from MSFT which involves:
- Retry policy when creating the secret client (EDIT: Removed after comments, to be considered in a separate MR)
- Improve caching when Storage calls `publishToEventGridTopic`
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
## Does this introduce a breaking change?
-------------------------------------
- [NO]
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Pending items
----------------
<!-- Are there changes that you'll introduce in upcoming MRs and hence did not add in this one? Next steps of your
feature can also be mentioned here. -->
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->M8 - Release 0.11Alok JoshiAlok Joshihttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/129Cherry-pick branch 'patch_to_enableBean_conditionally' into 'release/0.10'2022-12-22T18:58:13ZDavid Diederichd.diederich@opengroup.orgCherry-pick branch 'patch_to_enableBean_conditionally' into 'release/0.10'patch to conditionally enable this bean.
See merge request osdu/platform/system/lib/cloud/azure/os-core-lib-azure!128
(cherry picked from commit e5e1da1417a668811fb1d61e89b1ddcff1e37844)
45c02fdb patch to conditionally enable this bea...patch to conditionally enable this bean.
See merge request osdu/platform/system/lib/cloud/azure/os-core-lib-azure!128
(cherry picked from commit e5e1da1417a668811fb1d61e89b1ddcff1e37844)
45c02fdb patch to conditionally enable this bean.
0ddc2afe updated docs and property name.
981deb63 updated noticeDavid Diederichd.diederich@opengroup.orgDavid Diederichd.diederich@opengroup.orghttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/128patch to conditionally enable this bean.2023-08-18T12:44:24ZSmitha Manjunathpatch to conditionally enable this bean.## All Submissions:
-------------------------------------
* [YES/NO] I have added an explanation of what changes in this merge do and why we should include it?
* [YES/NO] I have updated the documentation accordingly.
* [YES/NO/NA] I have...## All Submissions:
-------------------------------------
* [YES/NO] I have added an explanation of what changes in this merge do and why we should include it?
* [YES/NO] I have updated the documentation accordingly.
* [YES/NO/NA] I have added tests to cover my changes.
* [YES/NO/NA] All new and existing tests passed.
* [YES/NO/NA] My code follows the code style of this project.
* [YES/NO/NA] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
High level design:
Issue: <!-- Link any __GitLab__ workitem(s) to this pull request. -->
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
## Does this introduce a breaking change?
-------------------------------------
- [YES/NO]
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Pending items
----------------
<!-- Are there changes that you'll introduce in upcoming MRs and hence did not add in this one? Next steps of your
feature can also be mentioned here. -->
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->M8 - Release 0.11Smitha ManjunathSmitha Manjunathhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/126added docs folder2023-08-18T12:44:26ZSmitha Manjunathadded docs folder## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES/NO] I have updated the documentation accordingly.
* [NA] I have added tes...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [YES/NO] I have updated the documentation accordingly.
* [NA] I have added tests to cover my changes.
* [NA] All new and existing tests passed.
* [NA] My code follows the code style of this project.
* [NA] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
<!-- Please describe the current behavior that you are modifying, 'or' link to a relevant issue.
Feel free to add references to any design documents you might have shared with the team or any
related MR that you are building on top of. -->
High level design:
Issue: <!-- Link any __GitLab__ workitem(s) to this pull request. -->
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
## Test coverage:
------------------
<!-- Mention unit test coverage of changes. -->
## Does this introduce a breaking change?
-------------------------------------
- [NO]
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Pending items
----------------
<!-- Are there changes that you'll introduce in upcoming MRs and hence did not add in this one? Next steps of your
feature can also be mentioned here. -->
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->M7 - Release 0.10Smitha ManjunathSmitha Manjunathhttps://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/merge_requests/125Add circuitbreaker to all inter service communication2023-08-18T12:44:28ZRonak SakhujaAdd circuitbreaker to all inter service communication## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] I have updated the documentation accordingly.
* [YES] I have added tests ...## All Submissions:
-------------------------------------
* [YES] I have added an explanation of what changes in this merge do and why we should include it?
* [NO] I have updated the documentation accordingly.
* [YES] I have added tests to cover my changes.
* [YES] All new and existing tests passed.
* [YES] My code follows the code style of this project.
* [YES] I ran lint checks locally prior to submission.
## What is the issue or story related to the change?
-------------------------------------
We are adding a circuitbreaker to all Interservice communication. All Services use HTTPClient's send method to make requests. In this MR, we are decorating the send method with a circuibreaker to avoid the problem of cascading fallback.
Be default, we are using default configurations of circuibreaker. Values can be found here(https://resilience4j.readme.io/docs/circuitbreaker#create-and-configure-a-circuitbreaker)
High level design:
![image](/uploads/6e831b2eafffb873f6f38632b4a69339/image.png)
CircuitBreaker is at the service level. At pod level communication, the URL for let's say entitlements service is defined as : http://entitlements/api/entitlements/v2 . We will fetch the host and make it as the key for circuitbreaker.
Issue: <!-- Link any __GitLab__ workitem(s) to this pull request. -->
<!-- Please add implementation details of current set of changes and how the code changes are
doing what they are expected to do. Are there any complex loops or designated code blocks that
should be elaborated? Is there some contextual knowledge that the reviewer should be aware of? -->
Change details:
We are adding a circuitbreakersingleton class to keep the circuitbreakerregistry. There is a flag which can be set to enable circuitbreaker for a service.
When circuitbreaks, it will start throwing error 500 without making http call.
## Test coverage & Tests:
------------------
<!-- Mention unit test coverage of changes. -->
Used Storage service and Entitlements service for testing.
While Entitlements was up, sent HttpRequests from Storage to Entitlements with success response.
Turned off Entitlements service and then sent requests from storage to entitlements which resulted in errors.
After the required number of calls, obtained log that circuit has opened and post which the requests were failing fast.
Tested the behavior by running on kubernetes cluster locally.
## Test on perf environment
I setup Storage and Entitlements on perf, and added a preauthorize on healthcheck in storage.
Scenario : Storage service calling entitlements
1. Behaviour when Entitlements is up :
![image](/uploads/194977dcf756eac71598260ec8226c7b/image.png)
2. Behaviour when Entitlements is down and circuit is closed :
![image](/uploads/aa6813f973711dd823d2aa86576433de/image.png)
3. Behaviour when Failure threshold is crossed and circuit is open :
![image](/uploads/6afaddc06ddf30d92d48f4d474cc09a1/image.png)
UPDATE : When Circuit is open, we are throwing Exception 503 : Service Unavailable
Logs generated when circuit gets open :
![image](/uploads/93788b1e68e14996451f02c5b8490897/image.png)
Tested to ensure multiple circuitbreakers for different services can be maintained.
## Does this introduce a breaking change?
-------------------------------------
- NO
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
## Pending items
----------------
1. Make all configuration of circuitbreaker configurable.
2. Segregate circuitbreakers to remove parameters from circuitbreaker name
## Reviewer request
-------------------
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR
-- Coding design: _\<Reviewer1>_
-- Backward Compatibility: _\<Reviewer2>_
-- Feature Logic: _\<Logic design\>_
-- _\<Any other context mention here>_
OR
-- _\<Component 1>_: _\<Reviewer1>_
-- _\<CosmosDB>_: _\<Reviewer2>_
-- _\<ServiceBus>_ _\<Reviewer3>_
-- _\<Mention any other component and owner>_
## Other information
-------------------------------------
<!-- Any other information that is important to this MR such as screenshots of how the component looks before and after the change. -->M8 - Release 0.11