-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Fix issue62 : Support customized log directory and configuration properties directory #804
Conversation
using the LongAdder rather than AtomicInteger to Provides better performance
merge master
…perties directory
Codecov Report
@@ Coverage Diff @@
## master #804 +/- ##
============================================
+ Coverage 42.25% 42.62% +0.36%
- Complexity 1419 1439 +20
============================================
Files 307 310 +3
Lines 8894 8979 +85
Branches 1203 1218 +15
============================================
+ Hits 3758 3827 +69
- Misses 4677 4684 +7
- Partials 459 468 +9
Continue to review full report at Codecov.
|
when will this be fixed ? we can not use it in production if custom configuration is unavailable. |
@vitrun I'll take a review these days. It's expected to be included in 1.7.0 (perhaps in the next few weeks). If you're using Spring Boot/Spring Cloud you could leverage Spring Cloud Alibaba to support configuring via |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/ConfigLoadUtils.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/AppNameUtil.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/ConfigLoadUtils.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/ConfigLoadUtils.java
Outdated
Show resolved
Hide resolved
…cator to load log config
merge onlie
add test cases |
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/ConfigUtil.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/alibaba/csp/sentinel/adapter/gateway/common/api/ApiPathPredicateItem.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/SentinelConfigLocator.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/SentinelConfigLocator.java
Outdated
Show resolved
Hide resolved
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/ConfigUtil.java
Show resolved
Hide resolved
merge online
feature support : retrieve properties from relative file.
Dear @sczyh30 would you help me view the code? |
friendly ping :) |
I'll review these days :) |
.../src/main/java/com/alibaba/csp/sentinel/adapter/gateway/common/api/ApiPathPredicateItem.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Excellent, thanks for contributing! Just one more thing to consider: it would be convenient if we could also support setting appName ( |
* add english document of transaction message design * Format the style.
Does this pull request fix one issue?
Resolves #62
Describe how you did it
Split the configuration into two parts: the log and the sentinel-core. There are special tool classes to load the respective configurations. The tool class supports reading specified files, default files, and virtual machine parameter configurations.
the sentinel-core support configurations :
Customize the loaded configuration file by configuring the
csp.sentinel.config.file
property.for example
-Dcsp.sentinel.config.file=sentinel.properties
the log:
Customize the loaded configuration file by configuring the
csp.sentinel.config.file
property.for example
-Dcsp.sentinel.config.file=sentinel.properties
Pay attention! the
log
andsentinel-core
configuration share a same config file nowConfigure effective priority: virtual machine parameters -> -Dcsp.sentinel.config.file specifies file configuration
If
-Dcsp.sentinel.config.file
is not specified, the default value issentinel.properties
. That means you only need to addsentinel.properties
to your project then you can load the custom configuration.If you are the old version of the specified directory configuration:
${user.home}/logs/csp/appName.properties
And you want to keep the existing configuration path, it is also ok. You don't need to configure
-Dcsp.sentinel.config.file
nor need to addsentinel.properties
to your project. Because it provides legacy compatibility.Describe how to verify it
Configure the attribute value and run the project to see if it works.
And you can run the test cases in
SentinelConfigTest
、LogBaseTest
、ConfigUtilTest