Commit Graph

264 Commits

Author SHA1 Message Date
Eric Zhao 87142ce512 Bump version to 1.7.2-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-12-25 11:19:07 +08:00
Eric Zhao 9c909e3631 Bump version to 1.7.1
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-12-24 20:05:23 +08:00
Eric Zhao e9d730cc39 test: Fix unstable test cases in MetricExitCallbackTest
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-12-24 19:54:46 +08:00
fangwentong 0e110c68ea Fix the logic of getting maxSuccessQps in StatisticNode (#1196) 2019-12-20 13:57:53 +08:00
Eric Zhao a63c1841ee Support setting config file path via system env and improve error handling in SentinelConfigLoader
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-12-18 19:00:52 +08:00
Eric Zhao c70565167f
refactor: Get the max allowed RT directly from SentinelConfig.statisticMaxRt() (#1173)
- to avoid the dependency chain: Constants -> SentinelConfig

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-21 17:03:10 +08:00
于玉桔 24f8d75601 Fix the incorrect logic of handling the end separator of the log directory in LogBase (#1172) 2019-11-21 13:37:50 +08:00
Eric Zhao 72a58f7ea7 Add Consumer functional interface in sentinel-core utils
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-20 13:55:26 +08:00
Eric Zhao 9705f54611 Bump version to 1.7.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-12 11:08:14 +08:00
Eric Zhao 8cdf1de854 Bump version to 1.7.0
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-11 21:12:58 +08:00
Eric Zhao 6bb2de8750 Support classification for Sentinel resources
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-06 21:00:08 +08:00
Eric Zhao cf5b955f12 Improve AssertUtil for collection checking
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-11-05 17:51:56 +08:00
Eric Zhao 74a40aa285
Improve Node and Metric interface to support conditional metric retrieval (#1115)
* Add detailsOnCondition method in Metric interface to filter MetricNode within the time condition.
* Add rawMetricsInMin method in Node interface, which will retrieve and generate metric items from the min-level sliding window on condition.
* Add test cases for detailsOnCondition.

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-10-25 16:03:07 +08:00
Eric Zhao b0905547ff Use ServiceLoaderUtil to create SPI ServiceLoader
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-10-23 19:20:53 +08:00
Eric Zhao 8d5654f727 Add ServiceLoaderUtil to improve SPI classloader mechanism and update SpiLoader
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-10-23 19:20:53 +08:00
wangyb dbf1f97dde Fix the cluster rule checking logic in FlowRuleUtil#checkClusterField() (#1105) 2019-10-22 20:28:21 +08:00
Eric Zhao 826447bc82
Fix the bug that resource name displayed in ClusterNode-related command APIs for SphU.entry(method) is incorrect (#1078)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-10-11 15:15:07 +08:00
windWheel 4e55a6a749 Optimize the slot order in DefaultSlotChainBuilder (#1056) 2019-09-23 09:45:22 +08:00
Eric Zhao 8b40981fca
Improve SystemRuleManager and refactor checking logic of maxCpuUsage strategy (#1050)
- The BBR period for maxCpuUsage strategy is deprecated. Now Sentinel will just check the CPU usage value, which could avert surge of CPU usage quickly
- Improve SystemRuleManager and SystemStatusListener
- Add some test cases

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-09-19 16:36:12 +08:00
Eric Zhao 9ff6e47bb0
Add concrete exception message in AsyncEntry#cleanCurrentEntryInLocal (#1047)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-09-19 09:38:07 +08:00
于玉桔 1253471078 Code refinement for JDK-picked classes (#1014) 2019-08-26 22:34:28 +08:00
aq0706 56c73698cb Support reading files with customized charset in ConfigUtil (#961) 2019-08-08 15:14:36 +08:00
Lin.Liang 61c8397e48 Fix temp file problem in log test cases (#908) 2019-07-16 09:41:44 +08:00
Lin.Liang 326dd4434d Fix the compatibility problem of ConfigUtil for Windows environment (#903) 2019-07-10 19:21:13 +08:00
Eric Zhao 90662a423b Code refinement for Sentinel config classes
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-07-08 23:06:07 +08:00
Lin.Liang ff33de199a Support arbitrary configuration properties file path for Sentinel (#804)
- Support customized log and configuration properties directory
2019-07-08 19:06:54 +08:00
yidadi c14e3296cb Refine the methods and variable name in SlotChainProvider (#871) 2019-06-27 16:50:43 +08:00
Braavos dca4440d40 Add unit tests for com.alibaba.csp.sentinel.eagleeye.EagleEyeCoreUtils (#854) 2019-06-24 09:28:08 +08:00
cdfive 8661d9abc1 Add support for logging into console for common logs (#836)
* Add a ConsoleHandler to support logging into stdout and stderr.
* Add a `csp.sentinel.log.output.type` property to configure for output type of record logs (only a temporary design)
* Add millisecond to the format of CspFormatter
2019-06-19 09:46:13 +08:00
Eric Zhao 00f116e344 Refine the DegradeRule and add validating logic for the two new attributes
- improvement of #789

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-06-17 20:38:02 +08:00
Lin.Liang 2eecd3ac6a Make the value of RT_MAX_EXCEED_N in DegradeRule configurable (#789)
- Add two attributes in DegradeRule: rtSlowRequestAmount and minRequestAmount
2019-06-14 17:42:03 +08:00
Lin.Liang e6e27c6faa Make maxParamByteSize configurable in ParamFlowRequestDataWriter of cluster client module and fix bugs (#823) 2019-06-13 22:38:26 +08:00
kexianjun 0176f0ead3 Use calculateTimeIdx to calculate array idx in LeapArray#getPreviousWindow (#723)
* also some code cleanup
2019-06-06 06:02:44 +08:00
Lin.Liang ee38587a6e Remove redundant operation when adding child node in NodeSelectorSlot (#794) 2019-06-04 18:02:43 +08:00
Lin.Liang 3a9e2629b7 Replace AtomicInteger with LongAdder for curThreadNum of StatisticNode (#747) 2019-06-04 17:51:36 +08:00
Eric Zhao f8ebbbccf4 Bump version to 1.7.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-05-25 15:07:19 +08:00
Eric Zhao 3d2c33ef1d Bump version to 1.6.1 (release)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-05-23 09:49:15 +08:00
Carpenter Lee f3e705c5f3 Add exceptionsToTrace and exceptionsToIgnore support in Tracer (#766)
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-05-22 10:06:03 +08:00
Eric Zhao 54da16d304 Refactor FlowRuleChecker to improve code reuse
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-05-22 09:47:41 +08:00
yikangfeng 4ec0462e31 Add getCpuUsageThreshold() method in SystemRuleManager (#770) 2019-05-21 16:00:46 +08:00
Carpenter Lee 18d8b4c8a7
Add CPU usage and system load to metric (#749)
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-05-10 14:20:00 +08:00
Eric Zhao 6e4560845c Update SENTINEL_VERSION constant to 1.6.1
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-05-06 13:46:03 +08:00
Carpenter Lee a2683383d1
[Feature]Add an extension to Sentinel internal statistics (#730)
Add Sentinel MetricExtension, which provides extension to Sentinel internal statistics.
This extension provides callbacks when a request passes rule checking, 
blocked by flow control, successfully end or exception occurred. 
Accompanied by these events, response time and current thread number 
will be recorded too.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-05-06 10:55:42 +08:00
Jason Joo ecf4822ae1 Make SentinelConfig.loadProps() thread-safe using CopyOnWriteArraySet (#706) 2019-04-25 20:00:44 +08:00
Eric Zhao 346e9b274e Bump version to 1.6.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-25 09:38:59 +08:00
Eric Zhao b1345f751f Bump version to 1.6.0 (release)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-24 20:42:32 +08:00
Eric Zhao 82578e1fdf
Refactor and improve fallback support for @SentinelResource annotation (#693)
- Refactor the semantics and logic for blockHandler and fallback
- Add `fallbackClass` support for fallback in global classes
- Add `defaultFallback` support
- Update test cases and demo

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-23 23:17:03 +08:00
Eric Zhao bb4fde58b8 Add appType property field in SentinelConfig
- The `appType` can be retrieved from `csp.sentinel.app.type` field. It's useful to identify the service type (e.g. API gateway).

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-23 21:06:31 +08:00
Eric Zhao c316211faf Add loadInstanceList support for SpiLoader
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-22 11:13:38 +08:00
yikangfeng 08611fae0f Add exceptionsToIgnore configuration support in @SentinelResource annotation (#683) 2019-04-21 15:57:12 +08:00
zhaixiaoxiang cb9335126c test: Fix unstable test cases in OccupiableBucketLeapArrayTest (#687) 2019-04-20 22:28:38 +08:00
Eric Zhao 7d344dcb95 Improve AbstractTimeBasedTest in sentinel-core
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-20 21:04:20 +08:00
Eric Zhao 79211f055c Add @SpiOrder annotation and update SPI loader for loading SPI with highest precedence
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-17 14:47:09 +08:00
jason 73f166e258 Make ClusterNodeTest.testGetOrCreateOriginNodeMultiThread stable 2019-04-12 10:42:08 +08:00
jason 16082a875c Make WarmUpRateLimiterControllerTest stable 2019-04-12 10:42:08 +08:00
Paul Kenneth Kent 4cc25429d3 Add unit tests for com.alibaba.csp.sentinel.util (#651)
* Add unit test for com.alibaba.csp.sentinel.util.IdUtil
* Add unit tests for com.alibaba.csp.sentinel.util.StringUtil
2019-04-09 09:14:51 +08:00
Eric Zhao 0c3bf96678 Bump version to 1.6.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-27 18:00:06 +08:00
Eric Zhao 48286e0ff8 Bump version to 1.5.1 (release)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-27 15:23:11 +08:00
Eric Zhao d5204bb6a4
Ensure Error caught in InitExecutor and do not exit when error occurs in LogBase (#613)
to avoid affecting normal logic of users

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-27 10:55:04 +08:00
Eric Zhao 61c525076f Improve SentinelResourceAspect and update test cases / document of annotation support
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-25 14:14:31 +08:00
beston123 6e1dfb374c Add exceptionsToTrace configuration support in @SentinelResource annotation (#543) 2019-03-25 13:57:57 +08:00
Eric Zhao 468327bdcd Remove useless global NodeBuilder in Env class
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-25 11:48:31 +08:00
Carpenter Lee 7feaf709fc Fix deadlock bug in Env static initialization (#610)
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-25 09:22:38 +08:00
Bo Zhang a3369378ad Apply Alibaba p3c pmd plugin/rules and fix/ignore all violations of priority 1 (#574) 2019-03-15 09:24:39 +08:00
Eric Zhao 0d4c47b23e Bump version to 1.5.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-14 16:50:53 +08:00
Eric Zhao 053f7172a3 Bump version to 1.5.0 (release)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-14 15:33:57 +08:00
Eric Zhao 1741da0bab
Automatically de-duplicate rules when loading rules (#571)
* De-duplicate rules automatically when loading rules
* Update rule managers

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-14 14:05:13 +08:00
Eric Zhao 044cdbb1bf
Add occupy mechanism for future buckets of sliding window to support "prioritized requests final pass" (#568)
* Rename: MetricsLeapArray -> BucketLeapArray
* Add implementation for `FutureBucketLeapArray`, a kind of `BucketLeapArray` that only reserves for future buckets, which is used for calculating occupied future tokens.
* Add OccupiableBucketLeapArray that combines common BucketLeapArray with FutureBucketLeapArray. The rollingNumberInSecond in StatisticNode now uses OccupiableBucketLeapArray by default.
* Add OccupySupport interface. Node now implements OccupySupport interface.
* Add occupy-related methods in Metric and ArrayMetric.
* Handle prioritized requests in default traffic shaping controller.
* Update default occupyTimeout to 500ms

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-14 10:04:56 +08:00
Eric Zhao 4b1ccd93e2
Refactor Node interface: change return type of `xxxQps` method from long to double (#564)
- Update test cases (use assertEquals(e, a, delta) instead)
- Also add `totalPass` method in Node interface

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-13 22:10:20 +08:00
Carpenter Lee 63d7c9d207 Revert "Add more overload methods in SphO and SphO" to avoid ambiguous method call
This reverts commit 35371c1

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-13 11:33:26 +08:00
Carpenter Lee 35371c1a3c Add more overload methods in SphO and SphO
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-13 10:34:42 +08:00
Carpenter Lee 341b6426f0 Record total inbound traffic data in metric file (#555)
- Regard the total inbound as a "virtual node" with the name `__total_inbound_traffic__`

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-11 18:25:45 +08:00
Eric Zhao 4073053b3a Update javadoc for core classes
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-11 18:07:29 +08:00
Eric Zhao 775484ba61
Add try-with-resources support for Entry class (#550)
- `Entry` class now implements `AutoCloseable` so it supports try-with-resources (`close` method adapts to `exit`)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-08 09:57:49 +08:00
yikangfeng 9ec1985755 Fix SimpleDateFormat concurrent issue in CspFormatter of sentinel-core (#548) 2019-03-06 20:39:33 +08:00
Carpenter Lee 5279895581 Add highestCpuUsage in system rule.
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-06 20:21:42 +08:00
Eric Zhao 1ffce6b579 Fix test dependencies
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-06 17:20:26 +08:00
Jason Joo 5d3ccb0863 Solve the issue that sleeping-based tests are not stable and optimize slow tests (#546) 2019-03-06 16:49:59 +08:00
ATAXGT 10d7c903cf Optimize circuit breaking state transformation using CAS in DegradeRule (#538)
close → open: use `compareAndSet` to update for `cut` attribute (changed to an `AtomicBoolean`)
2019-03-05 18:45:37 +08:00
Carpenter Lee 5d2170282f Add Sph.entryWithPriority() method to receive args
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-02-25 11:37:44 +08:00
mjaow 291742c171 Change default value of avgUsedTokens to zero to be more meaningful in DefaultController (#460) 2019-02-22 17:02:19 +08:00
Eric Zhao 5b260a9f75 Bump version to 1.5.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-02-21 19:41:50 +08:00
Eric Zhao 2e0fe23384 Bump version to 1.4.2 (release)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-02-20 14:15:33 +08:00
Eric Zhao 412e1ece47
Carry the triggered rule in subclasses of BlockException (#469)
* Extract getRule in BlockException and refine override methods in subclasses

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-31 14:24:05 +08:00
mjaow 5c0fd5651a Add volatile in double-checked locking field in ClusterBuilderSlot (#466) 2019-01-30 10:25:16 +08:00
Eric Zhao 35537a691e Refinement for test cases
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-29 10:28:07 +08:00
cdfive 22e8d85a8f Add some unit test for StatisticNode, ClusterNode and DefaultNodeBuilder class (#423) 2019-01-29 10:07:17 +08:00
Andres Almiray e893dd8c64 Make build faster by reducing fixed waiting time in tests (#449)
- Apply awaitility to core tests
- Cache maven local repo in Travis
2019-01-29 09:57:38 +08:00
Eric Zhao cd334406af Code and javadoc refinement
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-28 16:22:34 +08:00
luoxiangnan f306a03090 HashMap init optimize when adding new ClusterNode to cluster node map (#465)
- reuse old map size to avoid rearrange and rehash the map
2019-01-28 15:47:39 +08:00
mjaow 2cf6e29e72 Fix zero-count divide overflow bug in RateLimiterController (#461) 2019-01-28 14:23:41 +08:00
mjaow 223ad252df Remove duplicate comment in WarmUpController (#464) 2019-01-28 11:44:31 +08:00
mjaow 30907e4c9d Fix error value type and rename variable in EntranceNode class (#457) 2019-01-26 10:44:10 +08:00
Eric Zhao ba4fdcc638 Fixes #453: Support tracing exception count for specific entry or context in Tracer
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-25 16:34:17 +08:00
Eric Zhao 8e72211db9 Add catch throwable logic in ClusterStateManager to detect fatal error when loading SPI
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-25 13:48:31 +08:00
Carpenter Lee c45d64c619 Bug fix: fix 420, fix negative waitTime in RateLimiterController and WarmUpRateLimiterController
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-01-16 15:21:16 +08:00
kexianjun 9697c06739 Fix incorrect comment in NodeSelectorSlot javadoc (#419) 2019-01-15 17:18:07 +08:00
kangyl 47148acc1e Remove redundant semicolon in MetricWriter (#412) 2019-01-14 17:54:31 +08:00
Eric Zhao d4d85dbc7c Bump version to 1.4.2-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-04 19:08:07 +08:00
Eric Zhao 225d81ed93 Bump version to 1.4.1
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-04 14:59:50 +08:00