Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataSource integration for Consul #979

Merged
merged 7 commits into from
Aug 14, 2019
Merged

Conversation

wavesZh
Copy link
Contributor

@wavesZh wavesZh commented Aug 9, 2019

Describe what this PR does / why we need it

add consul data source

Does this pull request fix one issue?

#870

Describe how you did it

The data source first initial rules from a Consul during initialization.
Then it start a watcher to observe the updates of rule date and update to memory.

Because Consul do not provide http api to watch the update of KV, so i use a long polling and
blocking queries of the Consul's feature to deal it. When Querying data by index will blocking until change or timeout. If the index of the current query is larger than before, it means that the data has changed.

Describe how to verify it

see UT

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Aug 9, 2019

CLA assistant check
All committers have signed the CLA.

@codecov-io
Copy link

codecov-io commented Aug 9, 2019

Codecov Report

Merging #979 into master will increase coverage by 0.21%.
The diff coverage is 61.9%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #979      +/-   ##
============================================
+ Coverage     42.56%   42.77%   +0.21%     
- Complexity     1441     1450       +9     
============================================
  Files           310      311       +1     
  Lines          8984     9047      +63     
  Branches       1221     1228       +7     
============================================
+ Hits           3824     3870      +46     
- Misses         4693     4704      +11     
- Partials        467      473       +6
Impacted Files Coverage Δ Complexity Δ
...p/sentinel/datasource/consul/ConsulDataSource.java 61.9% <61.9%> (ø) 7 <7> (?)
...inel/datasource/zookeeper/ZookeeperDataSource.java 66.33% <0%> (-1%) 15% <0%> (-1%)
...tinel/slots/block/flow/param/ParamFlowChecker.java 55.4% <0%> (+2.7%) 29% <0%> (+1%) ⬆️
...a/csp/sentinel/slots/statistic/base/LeapArray.java 70.29% <0%> (+2.97%) 34% <0%> (+1%) ⬆️
...ava/com/alibaba/csp/sentinel/node/ClusterNode.java 100% <0%> (+4.76%) 8% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17365f3...dd43513. Read the comment docs.

@sczyh30 sczyh30 added the to-review To review label Aug 9, 2019
@sczyh30 sczyh30 added the area/integrations Issues or PRs related to integrations with open-source components label Aug 12, 2019
Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a README.md in the module for some instructions? You may refer to: https://github.com/alibaba/Sentinel/blob/master/sentinel-extension/sentinel-datasource-redis/README.md

@wavesZh
Copy link
Contributor Author

wavesZh commented Aug 12, 2019

Could you please add a README.md in the module for some instructions? You may refer to: https://github.com/alibaba/Sentinel/blob/master/sentinel-extension/sentinel-datasource-redis/README.md

👌

@sczyh30
Copy link
Member

sczyh30 commented Aug 12, 2019

And you could describe how the data source works in the PR description (e.g. it leveraged long polling).

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit ec30e89 into alibaba:master Aug 14, 2019
@sczyh30
Copy link
Member

sczyh30 commented Aug 14, 2019

Nice, thanks for contributing!

@sczyh30 sczyh30 removed the to-review To review label Aug 14, 2019
@sczyh30 sczyh30 added this to the 1.7.0 milestone Aug 14, 2019
@wavesZh
Copy link
Contributor Author

wavesZh commented Aug 14, 2019

Nice, thanks for contributing!

Thank you for your advice!

@wavesZh wavesZh deleted the datasource-consul branch April 1, 2020 14:03
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/integrations Issues or PRs related to integrations with open-source components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants