reset node
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
I use sentinel to implement resiliency for by web services.
I found it is very difficult to write multiple tests for the same resource with different rules because sentinel keeps context from the previous test.
For example sentinel_block_requests_total is already not null when the second test is running.
How to reset/clean all sentinel counts before each test using public API?
I use the following code:
ClusterNode node = ClusterBuilderSlot.getClusterNode(nodeName);
if (node!=null) {
node.reset();
node.metrics().clear();
node.metrics().values().clear();
}
But it does not help
I still see that node.totalExceptiopnI() is not set to 0
### Describe what happened (or what feature you want)
I need to reset all counters to null
### Describe what you expected to happen
### How to reproduce it (as minimally and precisely as possible)
1.
2.
3.
### Tell us your environment
java web services
### Anything else we need to know?
Contributor guide
Research direction
Start by tracing ClusterBuilderSlot.getClusterNode(nodeName), ClusterNode.reset(), and the node.metrics() calls described in the issue. Check how sentinel_block_requests_total and totalExceptiopnI are maintained, then determine whether the public API can reset them between tests. Done means a reproducible test shows all counters reset to zero before the next rule set runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100