Commit Graph

154 Commits

Author SHA1 Message Date
Eric Zhao 94026399bf Improve code and document of sentinel-datasource-etcd module
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-10-10 11:42:24 +08:00
Lin.Liang aeae6cfe37 Add Etcd data-source extension (#1018) 2019-10-10 11:19:27 +08:00
Neptune 582f32c35b Update Apollo client dependency to 1.4.0 in sentinel-datasource-apollo module (#1061) 2019-09-21 22:25:49 +08:00
tao.zhang 77932701b6 Add volatile for the stop flag of watcher in ConsulDataSource (#1054) 2019-09-20 15:30:03 +08:00
huangxfchn 4916ec35ee Improve annotation aspect to support throwing original exception in fallback and blockHandler (#986)
- extract the original exception from InvocationTargetException
2019-08-28 22:42:02 +08:00
Eric Zhao 976ddf8c48 Refine the document and javadoc for Spring Cloud Config data-source module
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-08-20 10:04:58 +08:00
Lin.Liang 30158bcac0 Add Spring Cloud Config data source extension (#899) 2019-08-20 09:39:27 +08:00
Eric Zhao 2682bd1aae Improve ConsulDataSource and add README.md for the module
- Change the unit of waitTimeout from ms to s (the previous implementation lay suffer the bug that ms/1000=0 when ms<=1000)
- Improve the error handling when parsing the value
- Add README.md

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-08-14 20:34:34 +08:00
tao.zhang ec30e897dc Add Consul DataSource integration module (#979) 2019-08-14 10:38:57 +08:00
0704681032 ebcf89024c Remove duplicate "exceptionBelongsTo" check in SentinelResourceAspect (#964) 2019-08-05 13:39:50 +08:00
Lin.Liang ba146765e3 Reuse connections of the same address in ZooKeeper data-source (#788)
* Fix the problem that too many connections (zkClient) are established
2019-06-27 13:39:56 +08:00
Eric Zhao 58a83b42aa Update ZooKeeper client in data-source module to 3.4.14 to fix vulnerability
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-06-19 10:09:20 +08:00
Eric Zhao d59beaec66
Fix the bug that numeric overflow might occur when refilling tokens in ParamFlowChecker (#838)
- use AtomicLong to replace AtomicInteger

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-06-18 13:39:37 +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
Eric Zhao 77dec5f845 Separate parameter metric storage from ParamFlowSlot and improve ParamFlowRuleUtil
- Add a ParameterMetricStorage specific for caching ParameterMetric (moved from ParamSlot)
- Add rule map building helper method in ParamFlowRuleUtil so that we can reuse it in other rule managers

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-05-22 09:47:41 +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 5f713bd404 Update toString() method of ParamFlowRule
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-22 14:46:38 +08:00
Eric Zhao e9719d32ec
Refactor flow algorithm for parameter flow control and support more traffic shaping mode (#677)
* support burst count, statistic interval per rule and throttling mode.
* Add fields in ParamFlowRule to support burst count, throttle, statistic interval per rule.
* Deprecate HotParamLeapArray and use token bucket algorithm directly.
2019-04-22 11:06:26 +08:00
yikangfeng 08611fae0f Add exceptionsToIgnore configuration support in @SentinelResource annotation (#683) 2019-04-21 15:57:12 +08:00
Eric Zhao df27e3ef9d Code refactor and refinement for FileInJarReadableDataSource
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-15 17:02:24 +08:00
nick.ding 882a06007d Add FileInJarReadableDataSource to support reading config file in jar (#646) 2019-04-15 12:06:34 +08:00
Eric Zhao 29f22e370b
Fix the NPE bug when passing null args to SphU.entry() and paramIdx is negative (#642)
- Also rearrangement of some code

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-04-04 09:40:23 +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 53a4e16144 Fix bug for completing entry with parameters in SentinelResourceAspect
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-26 12:53:39 +08:00
zhousiliang163 12c67d4770 Improve ZookeeperDataSource to deal with bad connection when initializing (#597) 2019-03-25 14:32:55 +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 f60394c651
Add test cases for sentinel-annotation-aspectj (#581)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-21 16:25:07 +08:00
lawrence wu 9051a6be96 Improve field naming in ApolloDataSource (#593) 2019-03-20 11:31:46 +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
Neptune 7367da6936 Upgrade apollo-client to 1.3.0 and add support for removing listener in sentinel-datasource-apollo (#562)
- Add to unsubscribe config change event
2019-03-11 11:39:47 +08:00
Carpenter Lee b8e295a138 Convert negative paramIdx of ParamFlowRule in ParamFlowSlot
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-07 10:29:51 +08:00
Carpenter Lee 80797ae85e Allow negative paramIndex as reversed-order in ParamFlowRule (#549)
* Allow negative paramIndex in ParamFlowRule

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2019-03-06 19:06:58 +08:00
Eric Zhao 1ffce6b579 Fix test dependencies
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-03-06 17:20:26 +08:00
逅弈 59d923ebc1 Add an ApiCommandHandler to list all available commands and description (#491)
* Add a ApiCommandHandler which fetch all registered CommandHandlers so that user can get all available CommandHandlers by request /api
* Add a customized CommandHandler demo
2019-03-01 13:39:50 +08:00
qinggeng ec0883d22e Add AuthInfo parameter in the constructor of ZooKeeperDataSource to support ACL (#508) 2019-02-26 17:29:16 +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 020a63fdb5
Bug fix: NPE when adding event count in ParamMapBucket (#494)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-02-20 13:57:05 +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
yanlinly 1368154000 Update Nacos SDK version to 0.8 and update Nacos namespace demo (#474) 2019-01-31 09:21:39 +08:00
Eric Zhao bac35ac100 Add back thread count metric type support for parameter flow control
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-30 09:37:13 +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 3109ac4bef Remove slf4j dependency in sentinel-annotation-aspectj
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-01-25 16:59:54 +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
Eric Zhao 832d6e425d Update document to meet Markdown lint
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-29 15:23:27 +08:00
format 4592c45741 Upgrade nacos-client version and construct NacosDataSource by Properties (#348)
* Polish #272: upgrade nacos-client version and create a new constructor for NacosDataSource to support namespace, endpoint, ak, sk and so on
* check properties in NacosDataSource
2018-12-28 00:27:25 +08:00
Eric Zhao f046194d6b Add sampleCount and windowInterval item to cluster config of flow rule and param rule
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-25 11:44:40 +08:00
Eric Zhao a2b91a9030 Refactor the constructor and units of LeapArray and related statistic class
- The constructor now accept `sampleCount` and `windowIntervalMs` so that it can match the two basic properties

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-24 18:02:50 +08:00
Eric Zhao 8096b22eb1 Add cluster embedded mode handling logic for parameter flow checker
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-18 19:58:08 +08:00
Eric Zhao 9916dad403 Bump version to 1.4.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-17 10:23:19 +08:00
Eric Zhao c7b5653249 Bump version to 1.4.0
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-14 14:59:27 +08:00
Eric Zhao a5819e092d Add HTTP command for modifying global state and client config
- Add several command handlers
- Update cluster state manager

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-14 10:54:30 +08:00
Eric Zhao 9a69104f79 Refactor param flow checker to support embedded server mode
- Add exception item extracting method in ParamFlowRule

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-14 10:52:28 +08:00
Eric Zhao 1043648fbc Update parameter flow rule to adapt to cluster mode and extract rule util class
- Update ParamFlowRule to support cluster mode
- Add `ParamFlowClusterConfig` to provide cluster mode items for the rule
- Update ParamFlowChecker to support cluster flow mode
- Extract ParamFlowRuleUtil class
- Change type of `flowId` from Integer to Long

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-12-14 10:52:21 +08:00
Eric Zhao 09ba7f081b Resolves #256: Support parameters in entry of Sentinel annotation support
- To enable parameter flow control in Sentinel annotation support

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-11-21 16:46:55 +08:00
Eric Zhao 2237727a11
Add prioritized entry support in ProcessorSlot and SphU (#255)
- Refactor the slot interface to support prioritized entry
- Add `entryWithPriority` in SphU

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-11-21 16:22:41 +08:00
Eric Zhao f8bc6f631a Code and javadoc refinement
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-11-20 20:06:55 +08:00
Eric Zhao 7fe3656e64 Update dependencies
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-11-19 14:37:54 +08:00
Eric Zhao 61a75af379 Add exception count trace for Sentinel annotation aspectj support
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-11-02 19:22:00 +08:00
bitonly 8f85dc5643 Add overloaded handleBlockException method for customized extension (#223) 2018-11-01 17:44:36 +08:00
Eric Zhao e0328d412a Remove logic of entering context when entering resource in annotation pointcut
- Rename AbstractSentinelAspect to AbstractSentinelAspectSupport

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-31 15:34:06 +08:00
bitonly cb09304ee2 Add abstract Sentinel aspect class for extension (#214) 2018-10-31 15:19:27 +08:00
Eric Zhao bffa4ff777 Bump version to 1.4.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-30 16:06:32 +08:00
Eric Zhao f4b5fae130 Bump version to 1.3.0-GA and update dependencies
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-30 15:01:51 +08:00
Eric Zhao 531578ce54 Bump version to 1.3.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-24 15:52:11 +08:00
Eric Zhao 5aad448191 Refactor logic of getting resource name in Sentinel annotation
- Enhance resolve name logic in MethodUtil
- Add test case for MethodUtil

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-24 14:46:42 +08:00
waveng 078df9db4f Sentinel annotation supports method name as default resource name (#187) 2018-10-24 09:42:51 +08:00
Carpenter Lee aaf88b8a0a Rename ParamFlowRule.blockGrade to grade 2018-10-16 20:34:40 +08:00
Carpenter Lee 52d16e62f2
update nacos version to 0.2.1
update nacos version to 0.2.1.  change default port. 8080 -> 8848. fix port conflict.
2018-10-16 14:05:20 +08:00
Eric Zhao 94dc7966ae Bump version to 0.2.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-28 17:18:41 +08:00
Eric Zhao 1063974ceb Bump version to 0.2.0
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-27 17:59:23 +08:00
Eric Zhao 87076a6977 Code and javadoc refinement
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-27 16:51:30 +08:00
Eric Zhao 5f5443a546 Update sample count for ParameterMetric
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-27 14:28:05 +08:00
Eric Zhao 88a02623ac
Add flow control by frequent (hot spot) parameters (#156)
- Add callback registry for statistic slot for extensions.
- Add a new module `sentinel-parameter-flow-control` under `sentinel-extension`.
- Add a `CacheMap` interface to provide abstraction for cache. We use ConcurrentLinkedHashMap as the default implementation (LRU strategy)..
- Add a `ParameterMetric` class as frequent parameter metrics for a specific resource. The metric map is located in `ParamFlowSlot` rather than `ClusterNode`.
- Implement `ParameterLeapArray` as statistic data structure for frequent parameters in a period of time window.
- Add `ParamFlowSlot` as the checker slot; Add `ParamFlowChecker` to do rule checking; Add `ParamFlowRuleManager` to do rule managing.
- The statistic metrics for frequent parameters is enabled only if the related resource has configured parameter flow rule; Parameter metrics for removed rules will be cleared automatically.
- Leverage extensible `SlotChainBuilder` to provide a `HotParamSlotChainBuilder`.
- Add command handlers for hot param rules.
- Add test cases and demo.
2018-09-27 14:15:47 +08:00
Eric Zhao cf1cf8a59f Update dependencies
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-26 15:03:19 +08:00
Eric Zhao b1f33675c5 Improvements for Redis data source and demo
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-14 15:02:55 +08:00
moon tiger 4ff2e37abb Add DataSource integration for Redis (#102)
- This implementation uses Lettuce as the internal client, and leverages Redis pub-sub feature to implement push mode data source. (by @tigerMoon)
2018-09-14 14:08:50 +08:00
Eric Zhao 50a5610010 Enhance file data source and flow rule manager
- Some refinement for file data source
- Add resource name checking in FlowRuleManager to avoid NPE

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-05 15:45:52 +08:00
yfh0918 175452a96a Enhance FileRefreshableDataSource and FileWritableDataSource (#125)
- Add method to check if the resource is modified in `AutoRefreshDataSource`
- Implement FileWritableDataSource
2018-09-05 12:36:46 +08:00
Eric Zhao 007cd9d291 Some refactor of data source
- Add `close` method in WritableDataSource (to extend AutoCloseable in JDK 1.7 later)
- Separate the writable file data source from original class
- Add a sample to show how to register data sources via Sentinel init mechanism
- Separate a writable data source registry from original handler to make it clear

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-04 11:09:42 +08:00
Eric Zhao 0060e8042a Refactor Sentinel data source hierarchy
- Spilt DataSource into two types: ReadableDataSource and WritableDataSource
- The AbstractDataSource now is read-only
- Refactor the file data source for writable implementation
- Rename: ConfigParser -> Converter (represents both encoder `T -> S` and decoder `S -> T`)
- Some other refinement

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-04 11:09:42 +08:00
Eric Zhao 9164bb19fe
Fix the bug when resolving original method to get annotation (#111)
- The method from the signature will return the method of interface, so we need to resolve declared method in target class

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-31 11:10:41 +08:00
Eric Zhao b212e5f26e Bump version to 0.2.0-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-08 20:45:25 +08:00
Eric Zhao 6bef9a8ee1 Bump version to 0.1.1
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-08 19:57:37 +08:00
Jason Song b51c3ad13e Add Apollo data source extension (#46) 2018-08-08 18:53:13 +08:00
Eric Zhao b1cf30fc24 Add support for shared block handler
- Update javadoc and document

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-08 10:40:38 +08:00
Eric Zhao 348b1c819b Add Sentinel annotation definition and aspectj extension
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-08 10:40:38 +08:00
Eric Zhao 0438d530d4 Update documents
- Update document for Dubbo demo
- Update document for extensions

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-07 19:43:32 +08:00
Eric Zhao fd936a4567 Update ZooKeeper data source integration
- Code refinement
- Add test cases

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-06 10:02:02 +08:00
guonanjun 3395412c57 Add ZooKeeper data source for Sentinel (#33) 2018-08-05 13:03:18 +08:00