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

Improve Config API #238

Merged
merged 2 commits into from
Sep 16, 2020
Merged

Improve Config API #238

merged 2 commits into from
Sep 16, 2020

Conversation

louyuting
Copy link
Collaborator

@louyuting louyuting commented Sep 12, 2020

Describe what this PR does / why we need it

Improve sentinel initialization mechanism

  1. The logging module init function sets the default logger to be a file logger(sentinel-record.log). Even if the user does not initialize sentinel, it will work properly.
  2. Reset logger by configEntity/yaml/default is optional. Reset logger only if the user sets logger in configuration.

Does this pull request fix one issue?

None

Describe how you did it

Describe how to verify it

UT

Special notes for reviews

@sczyh30

@louyuting louyuting requested a review from sczyh30 September 12, 2020 18:24
@louyuting louyuting added area/configuration Issue related to configurations of Sentinel to-review PRs to review labels Sep 12, 2020
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2020

Codecov Report

Merging #238 into master will decrease coverage by 0.39%.
The diff coverage is 5.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   42.93%   42.53%   -0.40%     
==========================================
  Files          74       74              
  Lines        4316     4356      +40     
==========================================
  Hits         1853     1853              
- Misses       2230     2271      +41     
+ Partials      233      232       -1     
Impacted Files Coverage Δ
api/init.go 0.00% <0.00%> (ø)
core/config/config.go 21.69% <0.00%> (-0.64%) ⬇️
core/config/entity.go 44.28% <0.00%> (-1.99%) ⬇️
core/log/metric/writer.go 0.00% <0.00%> (ø)
logging/logging.go 17.89% <100.00%> (ø)
core/system/rule_manager.go 79.03% <0.00%> (-15.20%) ⬇️
core/circuitbreaker/rule_manager.go 46.30% <0.00%> (-2.66%) ⬇️
core/hotspot/rule_manager.go 56.45% <0.00%> (-2.54%) ⬇️

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 f9ddf58...5f07458. Read the comment docs.

api/init.go Outdated Show resolved Hide resolved
func init() {
defaultFileLogger, err := NewSimpleFileLogger(GetDefaultLogDir()+RecordLogFileName, DefaultNamespace, 0)
if err != nil {
globalLogger.Error("fail to init global file logger")
Copy link
Member

Choose a reason for hiding this comment

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

Carry with error message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, updated

sczyh30
sczyh30 previously approved these changes Sep 15, 2020
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 1c01bbd into alibaba:master Sep 16, 2020
@sczyh30
Copy link
Member

sczyh30 commented Sep 16, 2020

Thanks!

@sczyh30 sczyh30 removed the to-review PRs to review label Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration Issue related to configurations of Sentinel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants