apolloconfig / apollo-java

Apollo Java Clients
Apache License 2.0
40 stars 72 forks source link

add multiple appId,pull other appId config into config. #70

Closed TerryLam2010 closed 3 days ago

TerryLam2010 commented 4 months ago

What's the purpose of this PR

add multiple appId pull into config see https://github.com/apolloconfig/apollo-java/issues/66

Which issue(s) this PR fixes:

Fixes #

Follow this checklist to help us incorporate your contribution quickly and easily:

Summary by CodeRabbit

These changes enhance the ability to manage and query configurations on a per-application basis, improving flexibility and granularity in configuration management.

github-actions[bot] commented 4 months ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

coderabbitai[bot] commented 4 months ago

[!NOTE] Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits Reviewing files that changed from the base of the PR and between 929b440b502d13bafd81edba76c6b76bbbe80dcc and 5a4507bf39aff28f6517b52ad0c087ca5b8ef072.
📒 Files selected for processing (1) * `apollo-client/src/main/java/com/ctrip/framework/apollo/spring/spi/DefaultApolloConfigRegistrarHelper.java` (5 hunks)
 ________________________________________
< C*deR*bb*t: The uncensored bug hunter. >
 ----------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

The recent updates to the Apollo Client introduce an appId parameter across multiple classes and methods. This enhancement improves configuration management by allowing retrieval and handling of configurations tailored to specific applications, facilitating greater flexibility and organization in multi-application environments. Additionally, the CHANGES.md file reflects a version update from 2.3.0 to 2.4.0, with a significant reduction in detailed entries.

Changes

Files/Groups Changes Summary
ConfigService.java, DefaultConfigManager.java, RemoteConfigLongPollService.java, DefaultConfigFactoryManager.java, PropertySourcesProcessor.java Added appId parameter to methods, enhancing multi-application configuration management.
AbstractSpringIntegrationTest.java, ConfigServiceTest.java, RemoteConfigLongPollServiceTest.java, PropertySourcesProcessorTest.java Updated test cases to reflect changes in method signatures and improve clarity in testing configurations.
AbstractConfig.java, AbstractConfigFile.java, AbstractConfigRepository.java, DefaultConfig.java, LocalFileConfigRepository.java, RemoteConfigRepository.java, SimpleConfig.java, YamlConfigFile.java Modified constructors and methods to include appId, improving configuration handling across various classes.
MockConfig.java, MockConfigFile.java, MockConfigFactory.java, MockConfigUtil.java Updated constructors and methods to incorporate appId, ensuring consistency in configuration handling.
ConfigUtil.java Added new methods for retrieving local cache directories and access keys based on appId.
CHANGES.md Updated milestone link and removed detailed entries for version 2.4.0.

Sequence Diagrams

Configuration Retrieval Flow

sequenceDiagram
    participant Client as Client
    participant ConfigService as ConfigService
    participant ConfigManager as ConfigManager
    participant ConfigRepository as ConfigRepository

    Client->>ConfigService: getConfig(appId, namespace)
    ConfigService->>ConfigManager: getConfig(appId, namespace)
    ConfigManager->>ConfigRepository: fetchConfig(appId, namespace)
    ConfigRepository-->>ConfigManager: return Config
    ConfigManager-->>ConfigService: return Config
    ConfigService-->>Client: return Config

Configuration Change Notification Flow

sequenceDiagram
    participant ConfigRepository as ConfigRepository
    participant RemoteConfigLongPollService as RemoteConfigLongPollService
    participant Client as Client

    ConfigRepository->>RemoteConfigLongPollService: submit(appId, namespace)
    RemoteConfigLongPollService->>Client: notify(appId, namespace, changes)
    Client-->>ConfigRepository: onRepositoryChange(appId, namespace, newProperties)

🐰 In fields of green, I hop with glee,
New app IDs bloom, oh what a spree!
Configs now dance, tailored with care,
Multi-app magic fills the air!
With each little change, our dreams take flight,
A brighter tomorrow, oh what a delight! 🌼

[!TIP]

You can customize the tone of the review comments and chat replies. Set the `tone_instructions` setting in your project's settings in CodeRabbit to customize the tone of the review comments and chat replies. For example, you can set the tone to `Act like a strict teacher`, `Act like a pirate` and more.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
nobodyiam commented 4 months ago

Thanks, it may take some time to reivew. In the meantime, could you please sign the CLA following the instructions provided by the CLA Assistant Lite bot?

TerryLam2010 commented 4 months ago

I have read the CLA Document and I hereby sign the CLA

nobodyiam commented 4 months ago

@TerryLam2010 It seems you committed the code with zhantian.lin@watsons.com.cn, which isn't associated with your GitHub account.

Anilople commented 3 months ago

The monitor metric #74 maybe changed if support multiple appId @Rawven

Rawven commented 3 months ago

如果支持多个 appId,监控指标#74可能会改变@Rawven

I'll adapt it after it's merged

TerryLam2010 commented 3 months ago

I have changed the Email for submitting code to 36256759+TerryLam2010@users.noreply.github.com, and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

nobodyiam commented 2 months ago

I have changed the Email for submitting code to 36256759+TerryLam2010@users.noreply.github.com, and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

emm...You may first backup the local repo and try the following:

1. git checkout main
2. git checkout -b 20240703-apollo-multiple-appid-new
3. git merge --squash 20240703-apollo-multiple-appid
4. git commit -m "some commit message"
5. git push origin 20240703-apollo-multiple-appid-new:20240703-apollo-multiple-appid
nobodyiam commented 1 month ago

I have changed the Email for submitting code to 36256759+TerryLam2010@users.noreply.github.com, and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

emm...You may first backup the local repo and try the following:

1. git checkout main
2. git checkout -b 20240703-apollo-multiple-appid-new
3. git merge --squash 20240703-apollo-multiple-appid
4. git commit -m "some commit message"
5. git push origin 20240703-apollo-multiple-appid-new:20240703-apollo-multiple-appid

I noticed the CLA check failed again, and it seems the original commits are back. Is there some mistaken operation on the branch?

image

TerryLam2010 commented 1 month ago

Jason, my unit tests pass perfectly when I run them locally, but fail when I run them on GitHub.

nobodyiam commented 2 weeks ago

@TerryLam2010 As this pull request is quite large and already takes a lot of time in reviewing. I suggest scheduling an online meeting for a thorough, quick review. If that works for you, please email me at nobodyiam@gmail.com to arrange a suitable time.