alibaba / sentinel-golang Goto Github PK
View Code? Open in Web Editor NEWSentinel Go enables reliability and resiliency for Go microservices
Home Page: https://sentinelguard.io/
License: Apache License 2.0
Sentinel Go enables reliability and resiliency for Go microservices
Home Page: https://sentinelguard.io/
License: Apache License 2.0
Type: feature request
Add any other context or screenshots about the feature request here.
Rule based flow control
Implement flow slot based on core pipeline. flow slot is stateless and implements flow control based on rules.
Each rule can have its own window length, different window length is very important to degrade service.
sentinel will reuse the dashboard of java version.
Add any other context or screenshots about the feature request here.
configurations when system start.
maybe use yaml or similar configuration file
Add any other context or screenshots about the feature request here.
BucketLeapArray.resetWindowTo bug.
Change windowWrap.value from interface{} to atomic.Value
Will fixed it.
Type: feature request
Define datasource extension framework
implement FileRefreshableDataSource
Add any other context or screenshots about the feature request here.
Type: feature request
FileRefreshable DataSource implementation
Add any other context or screenshots about the feature request here.
Circuit breaker
|
|
|
|
| update rules dynamically
|
|
|
+-------------------------+-------------------------------------------------------------------------------------------------------------------+
entry | | Circuit Breaker Slot |
| v |
--------------+-> |
| |
| +-----------------------------+ +-----------------------------+ +-----------------------------+ +-----------------------------+ |
| | +-------------------------+ | | +-------------------------+ | | +-------------------------+ | | +-------------------------+ | |
| | | | | | | | | | | | | | | | | |
| | | AverageRtBreakerRule | | | | ErrorRatioBreakerRule | | | | ErrorCountBreakerRule | | | | XXXBreakerRule | | |
| | | | | | | | | | | | | | | | | |
| | +-----------^-------------+ | | +------------^------------+ | | +-----------^-------------+ | | +------------^------------+ | |
| | | +--->| | +--->| | +-->| | | |
| | +-----------+-------------+ | | +------------+------------+ | | +-----------+-------------+ | | +------------+------------+ | |
| | | AverageRtCircuitBreaker | | | |ErrorRatioCircuitBreaker | | | |ErrorCountCircuitBreaker | | | | XXXCountCircuitBreaker | | |
| | | .CanPass()? | | | | .CanPass()? | | | | .CanPass()? | | | | .CanPass()? | | |
| | | | | | | | | | | | | | | | | |
| | +-------------------------+ | | +-------------------------+ | | +-------------------------+ | | +-------------------------+ | |
| +-----------------------------+ +-----------------------------+ +-----------------------------+ +-----------------------------+ |
| |
+---------------------------------------------------------------------------------------------------------------------------------------------+
There are Four main entity:
XXXBreakerRule: rule status machine
XXXCircuitBreaker: the check logic whether
RuleManager: manage all XXXCircuitBreakers and update rules dynamically.
CircuitBreakerSlot: As a CheckSlot to encapsulate all logic about circuit breaker.
Type: feature request
Add unit test for flow control
Code path: core/flow/*
Target coverage: 50+% statements.
Add any other context or screenshots about the feature request here.
Type: feature request
Add support for system adaptive rule (adaptive traffic shaping based on metrics like CPU usage, system load and overall QPS/RT.
Type: feature request
Support go 1.14 in CI
Add any other context or screenshots about the feature request here.
func (mb *metricBucket) addRt(rt int64) {
mb.add(base.MetricEventRt, rt)
if rt < atomic.LoadInt64(&mb.minRt) {
atomic.StoreInt64(&mb.minRt, rt)
}
}
here, not concurrent safe for mb.minRt
. It's better to use Mutex
another missing:
func (n *BaseStatNode) AddRtAndCompleteRequest(rt, count uint64) {
n.rollingCounter.AddCount(base.MetricEventComplete, int64(count))
n.rollingCounter.AddCount(base.MetricEventRt, int64(count)) // should be `rt`
}
Type: bug report
Thanks for your work.
Type: feature request
Data-source and data property listener (SentinelProperty
and PropertyListener
in Java). Some considerations:
SentinelProperty
(with different parsers) shared by the single data-source.Type: feature request
The implementation of LoadRules() in rule_manager.go might be not elegant, and the channel ruleChan seems to have no obvious meaning.
Call onRuleUpdate() to load rules in LoadRules().
Add any other context or screenshots about the feature request here.
Type: feature request
Currently, the metrics is record in monitor log file。
We might need to standardize the metric export. So we could export the metrics information to downstream monitor system. Such as prometheus。
We might need standardize the interface. The way to downstream could be log file、kafka and so on,
The use case:
K8s HPA
Add any other context or screenshots about the feature request here.
Type: feature request
Add integration module for beego. Discussions and contributions are welcomed!
Type: feature request
Adapt etcd as dynamic datasource for Sentinel
Need detail design.
PR
Add any other context or screenshots about the feature request here.
Type: feature request
Including:
Add any other context or screenshots about the feature request here.
Type: feature request
Add metric log implementation. We might need to keep the format consistent with the Java version. See the document of metric log format.
Type: feature request
use Functional Options Pattern to create Entry.
Easy to expand, and more readable.
Add any other context or screenshots about the feature request here.
Type: feature request
Implement throttling traffic shaping strategy (leaky bucket + queueing).
沟通开发事项
dingtalk or Gitter 都行
None.
Type: feature request
Add Nacos dynamic data-source module for Sentinel. Detailed design is needed.
Type: feature request
Add integration module for RocketMQ.
Consumer/Provider filter.
Add any other context or screenshots about the feature request here.
unified logger to record log
Type: feature request
Currently, logging config and general config is separated.
Unifying all configurations makes sense
Add any other context or screenshots about the feature request here.
Type: feature request
Discussing the design about Cluster Flow Control
Refer to Java Sentinel implement: https://github.com/alibaba/Sentinel/wiki/集群流控
Some Draft Proposal:https://github.com/alibaba/sentinel-golang/wiki/集群流控(Proposal)
Youtube cluster flow control: https://github.com/youtube/doorman
Add any other context or screenshots about the feature request here.
Type: feature request
if possible, avoid passing interface{}
in Rule converter function, same or like this:
// *_rule_manager.go
func Convert(data interface{}) error {
config := data.([]byte)
// convert config to FlowRule/SystemRule
}
which is not elegant and maybe not friendly for multiple configuration format.
Add any other context or screenshots about the feature request here.
Type: feature request
Add metric log unit test
Code path: core/log/metric/*
Target coverage: 80+% statements.
Add any other context or screenshots about the feature request here.
催更
Type: feature request
Add integration module for Gin web framework. Discussions are needed.
Type: feature request
Add local leaky bucket in traffic shaping
Add any other context or screenshots about the feature request here.
Type: feature request
Investigate the feasibility of adapting Sentinel to the cloud native
Need detail investigation document.
Add any other context or screenshots about the feature request here.
Type: feature request
Add integration module for dubbo-go client and server.
Discussions are welcomed!
Add any other context or screenshots about the feature request here.
refactor statNode
Add any other context or screenshots about the feature request here.
Type: feature request
Add unit test for statistic module
Code path: core/stat/*
Target coverage: 80+% statements.
Add any other context or screenshots about the feature request here.
Type: feature request
basic data structure implemented by sliding window is to record basic metrics, including PASS, BLOCKED, SUCCESS, ERROR, RT.
Here is a benchmark:
type Student struct {
Name string
Age int
Class string
Score int
}
func DirectInvoke(s *Student) {
s.Name = "Jerry"
s.Age = 18
s.Class = "20005"
s.Score = 100
}
func PointerInvoke(p unsafe.Pointer) {
s := (*Student)(p)
s.Name = "Jerry"
s.Age = 18
s.Class = "20005"
s.Score = 100
}
func InterfaceInvoke(i interface{}) {
s := i.(*Student)
s.Name = "Jerry"
s.Age = 18
s.Class = "20005"
s.Score = 100
}
func BenchmarkAssertDirectInvoke(b *testing.B) {
s := new(Student)
b.ResetTimer()
for i := 0; i < b.N; i++ {
DirectInvoke(s)
}
_ = s
}
func BenchmarkAssertPointerInvoke(b *testing.B) {
s := new(Student)
b.ResetTimer()
for i := 0; i < b.N; i++ {
PointerInvoke(unsafe.Pointer(s))
}
_ = s
}
func BenchmarkAssertInterfaceInvoke(b *testing.B) {
s := new(Student)
b.ResetTimer()
for i := 0; i < b.N; i++ {
InterfaceInvoke(s)
}
_ = s
}
The result is:(Macbook pro, 2015year, 13in, 8GB memory)
go test -bench='BenchmarkAssert*' -benchmem
goos: darwin
goarch: amd64
pkg: study_golang/study/basic/reflect
BenchmarkAssertDirectInvoke-4 1000000000 0.346 ns/op 0 B/op 0 allocs/op
BenchmarkAssertPointerInvoke-4 1000000000 0.352 ns/op 0 B/op 0 allocs/op
BenchmarkAssertInterfaceInvoke-4 544477173 2.09 ns/op 0 B/op 0 allocs/op
PASS
ok study_golang/study/basic/reflect 2.147s
It seems the performance using unsafe.Pointer is better than interface{} in some scenario.
Such as update MetricBucket.
Need to discuss.
Type: feature request
Add integration module for gRPC client and server.
We may leverage the interceptor mechanism like UnaryServerInterceptor
and StreamServerInterceptor
. Discussions are welcomed!
Type: feature request
according to control behavior to split rule.
Add any other context or screenshots about the feature request here.
#Issue Description
Type: feature request
Currently, logging module define the standard log interface (Logger and provide the capacity to extend this own logging component.
User could use other logging component, like Logrus and zap, to replace the default logging.
Besides, Sentinel should standardized log format. using log message + KV parameters to replace current implementation,
While doing unit tests, we usually need to use mock functions. In the current project, mock codes seem to be implemented manually, such as StatNodeMock in core/base/stat_test.go, MetricItemRetrieverMock in core/log/metric/aggregator_test.go, and so on.
As the project progresses, more and more mock functions will be available. To improve efficiency, we can consider automatically generating mock functions, by using mockery(https://github.com/vektra/mockery).
Type: feature request
By running "go generate", we can get all mocks for all interfaces to be tested.
I found this while solving issue 46, and prepare to implement the test function based on the new mock function.
Add any other context or screenshots about the feature request here.
Type: feature request
Add unit test for system slot
Code path: core/system/*
Target coverage: 50+% statements.
Add any other context or screenshots about the feature request here.
Type: feature request
Add unit test for common util
Code path: util/*
Target coverage: 50+% statements.
Add any other context or screenshots about the feature request here.
Type: feature request
FlowRuleManager
)We may improve the design based on Sentinel C++.
Type: enhancement
In previous implementations, when users update the flow rules with flow.LoadRules(xxx)
function, the previous traffic shaping controllers will be cleared and replaced by the new ones. Sometimes it's more sensible to keep the original traffic shaping controller if the fundamental property items of the flow rule remain unchanged, especially for stateful traffic shaping controllers. This could be improved.
Type: feature request
Add any other context or screenshots about the feature request here.
Implement Golang version of Sentinel, including basic statistic and flow functions. Some expected features:
Discussions are welcomed!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.