Commit Graph

264 Commits

Author SHA1 Message Date
waveng 078df9db4f Sentinel annotation supports method name as default resource name (#187) 2018-10-24 09:42:51 +08:00
Carpenter Lee 85c844eb9c
Config whether pid is needed in the log file name (#194)
- Change log file name;
- Add configurability to log file name and metric file name.
2018-10-23 19:03:23 +08:00
Carpenter Lee bbea62a5c7 Add StringUtil.capitalize() method 2018-10-19 11:04:30 +08:00
Carpenter Lee b85d8ef1db Change behavior when exception occurred in InitExecutor. Will not call System.exit(), just print stack trace 2018-10-16 20:24:02 +08:00
Eric Zhao 7626bf4a49 Code enhancement for #161
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-10-16 17:06:36 +08:00
Carpenter Lee ba10d10aa9
Bug fix: fix wrong log file name checking (#182) 2018-10-16 17:03:22 +08:00
jasonjoo2010 0916a9bfa2 Enhancements in transport-netty-http and properties related (#161)
* sentinel-transport-netty-http will also retry when port specified has been used
* LogBase support variable arguments
* Remove duplicated JVM properties overriding in SentinelConfig
* Add VersionUtil to get version from jar
2018-10-16 11:23:53 +08:00
李豪 9ae079c152
Support degrade by exception count (#174)
* Add a new DegradeRule type, degrade by exception count in the last 60 seconds
* Add demo about degrading by exception count
2018-10-11 16:39:38 +08:00
Carpenter Lee 570c3ee5b7 Change intervalInSec of StatisticNode.rollingCounterInMinute to 60 seconds 2018-10-11 14:24:33 +08:00
李豪 03922dbf6c
Enhancement/normalize metric field (#170)
normalize metric fields and methods:
- rename exception to exceptionQps;
- remove ed postfix of all fields and methods about metrics;
2018-10-11 09:28:43 +08:00
Carpenter Lee 85540229e9 Change eagleEye log path when log base configured. 2018-10-08 19:46:38 +08:00
Carpenter Lee 4610bd3da6 Use System property to config log base dir
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
2018-10-08 16:23:05 +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 9c2683e6ba Log warn when amount of context exceeds the max capacity for the first time
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-27 16:53:07 +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 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 9e012d2e20 Refactor version representation and add client version to heartbeat
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-25 16:52:28 +08:00
Eric Zhao 7c179bb592 Update integration test and demo for async entry
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-25 11:43:23 +08:00
Eric Zhao e50fc55d68 Add more test cases for Sentinel core internal (e.g. Entry, CtSph)
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-20 23:23:46 +08:00
Eric Zhao fe6b4f4865 Some code update and rearrangement
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-20 23:22:52 +08:00
Eric Zhao 62decf0464 Some bug fixes and enhancement for async entry support
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-20 23:20:53 +08:00
Eric Zhao cbaacfda55 Bug fix for automatic exit of default context when exiting the entry
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-20 23:19:50 +08:00
Eric Zhao be43a31dc4
Fix internal bug when amount of context exceeds the threshold (#152)
- When amount of context exceeds the threshold, the `NullContext` will be set to current thread local. Thus, when checking context in `CtSph#entry`, once `NullContext` detected, the entry will not do rule checking on the slot chain.
- Cache the default context during initialization. Then when amount of context exceeds the threshold, entries under default context can do rule checking under default context.
- Enhance the error message

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-19 14:01:07 +08:00
Carpenter Lee 91f27977e9 1. Refector SampleCountProperty and IntervalProperty;
2. Add more java doc for LeapArray.
2018-09-17 14:15:12 +08:00
Eric Zhao 015efe2f9b Separate checking logic from AuthorityRule and add test cases
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-17 11:41:51 +08:00
Carpenter Lee b5b3f6edee Bug fix: fix probability of metric lose 2018-09-16 21:13:06 +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
Eric Zhao 5edac71fef
Add support for asynchronous invocation entry (#146)
- Add several `asyncEntry` method in `Sph` interface and `SphU` class.
- Add a new `AsyncEntry` class for asynchronous entry representation. Some refactor for `CtEntry`.
- Refactored `CtSph` and implement `asyncEntryInternal` for asynchronous entry.
- Add `runOnContext` and `replaceContext` method in `ContextUtil` for context switching.
2018-09-14 10:07:27 +08:00
Eric Zhao 54905497d0 Refactor LeapArray to reuse code for current bucket
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-12 19:17:25 +08:00
Eric Zhao 2a3e33590f Update test cases and demo for async support
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-12 18:53:24 +08:00
Eric Zhao ca2f4d9fae
Support extensible slot chain builder using SPI mechanism (#145)
- Support extensible `SlotChainBuilder` using SPI mechanism
- Add a `SlotChainProvider` to load slot chain builder and create new slot chains

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-12 13:53:43 +08:00
Eric Zhao d798794ab3 Refactor the context and entry to support asynchronous invocation chain
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-12 11:46:21 +08:00
Eric Zhao d142a07a39 Enhance log and null check for rule managers
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-10 15:44:42 +08:00
Eric Zhao ed30f85f9c Fixes #128: Fix early return when exception ratio is 100%
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-09-05 19:03:27 +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
Carpenter Lee 6799da270d Fixed #109: fix miss-usage of ClusterNode.successQps() in DegradeRule.passCheck() method 2018-09-03 11:54:59 +08:00
Shalti 2772f189ab Fixed CR comments 2018-08-29 21:19:16 +08:00
Shalti dc0a7086b5 Renamed to MetricsReader 2018-08-29 21:19:16 +08:00
Shalti ac8698ed9f Refactored some classes 2018-08-29 21:19:16 +08:00
Carpenter Lee d716f0f14a Fixes #99, fix miss comparison of FlowRule.maxQueueingTimeMs 2018-08-29 17:48:04 +08:00
子矜 cedd420336 jialianglinjl 2018-08-29 15:33:33 +08:00
Eric Zhao 23f65b9fee Update dependencies and add log
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-17 11:17:24 +08:00
Eric Zhao 94aea568f6 Miscellaneous update
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-15 15:33:29 +08:00
Eric Zhao 820160d542 Fix update logic of minRt in bucket
- Fix incorrect usage. It's not thread-safe when comparing and updating `minRt`, but it's okay since the actual minimum RT often matches free load.

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-14 20:23:42 +08:00
Eric Zhao 6392cb0336 Modify loading mechanism of authority rules: only pick first
- Comment/javadoc refinement

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-13 14:42:33 +08:00
Eric Zhao 4226868dcf Fix typo in rule constants and add authority rule demo
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-13 11:22:03 +08:00
Eric Zhao 227776a301 Fixes #52: Error file separator regex in Windows environment
- This bug can cause init failure of `AppNameUtil`

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-09 15:16:11 +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
Eric Zhao a65d16083d
Optimize for statistic data structures (#47)
* Optimize for leap array

- Fix a bug: old position is not cleaned when inserting into a new (empty) position
- Reuse buckets for optimization
- The strategy is now changed: deprecated buckets will not be reset until newer time triggered. LeapArray is responsible for filtering the deprecated buckets (e.g. in `list` or `values`)
- Update test cases

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-08 19:36:42 +08:00
Carpenter Lee 40514587ac Set SystemRule's threshold to zero is allowed. 2018-08-08 14:33: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
yizhenqiang 8075232cdd Add volatile to methodNameMap and chainMap (#34)
Modify MethodUtil#methodNameMap and CtSph#chainMap: add `volatile` to keep in line with others
2018-08-05 09:05:55 +08:00
Eric Zhao b2a3ef26a7 Fixes test cases for degrade regarding the new strategy
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-08-01 22:24:00 +08:00
Carpenter Lee f144a2713f Refine Degrade rule checking. 2018-08-01 17:48:53 +08:00
Eric Zhao b113219c27 Fixes #14: Apply Alibaba Java Coding Guidelines
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-07-31 10:40:02 +08:00
Carpenter Lee bc620d616f Refine AppNameUtil 2018-07-31 10:26:37 +08:00
Eric Zhao 47d9070a4a
Fixes #9: Use named thread factory for identification (#10)
* Use named thread factory with all thread pools for identification

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-07-30 18:10:56 +08:00
Eric Zhao 6b6d13ca76 Add Nacos datasource integration
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-07-30 17:39:47 +08:00
Carpenter Lee 5d5b19e9d7 Set default FlowRule.grade to RuleConstant.FLOW_GRADE_QPS 2018-07-27 17:50:03 +08:00
Eric Zhao 934816b9ab Bump version to 0.1.1-SNAPSHOT
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2018-07-27 16:47:14 +08:00
Eric Zhao c92fea5d46 Welcome to the world, Sentinel 2018-07-27 16:34:30 +08:00