polarismesh / polaris-go Goto Github PK
View Code? Open in Web Editor NEWLightweight Go SDK used as Proxyless Service Governance
License: Other
Lightweight Go SDK used as Proxyless Service Governance
License: Other
Describe the bug
在使用polaris-go的过程中发现,如果polaris-server一开始就挂掉,获取限流配置每次都是两秒,超时两秒在生产环境是不可接受的。然后我又尝试获取过一次配置之后,再把polaris-server停止,不再有超时现象。我觉得哪怕最开始的时候获取不到限流配置也应该缓存下,后续在更新缓存, 不应该阻塞正常业务。
To Reproduce
Steps to reproduce the behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
What is the feature you want to add?
active health check feature
Why do you want to add this feature?
some kind of service has very few QPS at the free time, for detect the failure asap, we need active health check always
How to implement this feature?
send health check request from callee, users will config the health check url in sdk config
Additional context
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
在使用grpc-poloris-go的时候,当前配置只能通过配置文件的方式设置,我们场景中需要用到代码配置能力,结合代码,需要修改配置结构体字段标签为omitempty,确保设置了有效值的字段才被导入到配置对象里。
After AddChangeListener, seems no way to remove it.
What is the feature you want to add?
支持熔断规则的远程配置
Why do you want to add this feature?
sdk当前只支持本地规则配置,需要扩展远程规则配置
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
ratelimit feature should not rely on the remote config, user can use the feature when he is only use the polaris-go sdk
Why do you want to add this feature?
when user use the ratelimit feature, he can use this feature without the remote configuration
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
1. 主要问题
当创建一个路由规则, 是类似于
{srcService: *, srcNamespace: *} -> {dstService: serivceA, dstNamespace: namespaceA}
表明对所有的主调方生效。
这个时候每个服务在拉取路由规则的时候,其中的outbound都会多一条:
{srcService: selfService, srcNamespace: selfNameSpace} - > {dstService: serivceA, dstNamespace: namespaceA}
当我调用一个服务,serviceB. 而这个serviceB不在outbound里面。
就会因为match不上而导致路由失败。
2. 可能导致问题的场景
我对一个服务创建了一个对所有主调生效的规则。
这个时候所有的服务srcService的outbound都会多一条规则。导致原本可以调用的服务不可调用了。
3. 可能的解决方式
当dstService没match到outbounds上,就走默认的路由规则。
Describe the bug
polaris-go has config some internal server addresses on code, which need to be remove
To Reproduce
NewConsumerAPI, without passing any parameters, it will auto connect to the internal server addresses
Expected behavior
if user not passing any server address, sdk will return an error
Environment
Additional context
Add any other context about the problem here.
What is the feature you want to add?
find . -name "*.go" -type f | grep -v .pb.go|grep -v test/tools/tools.go | grep -v pkg/plugin/register/plugins.go | xargs -I {} goimports-reviser -rm-unused -format {} -project-name github.com/polarismesh/polaris-go
find . -name "*.go" -type f |grep -v .pb.go|grep -v test/tools/tools.go | grep -v pkg/plugin/register/plugins.go | xargs -I {} goimports -local github.com/polarismesh/polaris-go -w {}
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
请求标签的key、value均为*时,无法匹配到机器
举例子:有env:prod, env:dev的2个实例
命名空间、服务名 配置为 *
请求标签也均配置为 *
To Reproduce
Expected behavior
req不设置目标服务的tag,可以根据远程规则正确匹配
Environment
golangci-lint config
Describe the bug
如果 newProviderAPI 使用 address ,那么config 使用 file 实例化。则获取不到config内容。
但是如果newProviderAPi使用file 实例化。那么ConfigAPI就可以获取到内容了。
As a well-known manufacturer at home and abroad, even the basic go code specifications have not been done well. It looks really uncomfortable. The last project was the polaris project. I can't think of this polaris-go as well. Is this the style of the big factory? It's really low. It is recommended that you first standardize the code, go fmt the code, and then open it to the outside world. Don't you big manufacturers feel ashamed?
Even if you use vim or vscode editors, you can do some basic code formatting after writing the code. It is recommended to use the goland editor and the golanglint tool. It is fine to format the code of the entire project once. At the very least, when someone else contributes to you, it will look more comfortable and not so uncomfortable.
The code is written for people to see. If the open source code is presented to go developers or trailblazers, it should be carefully polished, rather than being fine after writing, and then executing go build, no matter what. This is not the style of an open source project. As a large company that has attracted much attention from the industry, you should reflect on which link has gone wrong, whether open source has not been properly checked, or whether your go developers are at this level, then Just huh.
创建配置中心示例文档
What is the feature you want to add?
support push metrics data to prometheus
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
增加API,用户可以单独使用路由和负载均衡功能,不依赖北极星的服务发现机制
Why do you want to add this feature?
与其他框架对接时,框架往往会单独使用路由和负载均衡能力,北极星当前一体化的API对接起来比较困难
How to implement this feature?
增加routerAPI
// RouterAPI 路由API方法
type RouterAPI interface {
SDKOwner
// process routers to filter instances
ProcessRouters(*ProcessRoutersRequest) (*ProcessRoutersResponse, error)
// process load balancer to get the target instancesbbbb
ProcessLoadBalance(*ProcessLoadBalanceRequest) (*ProcessLoadBalanceResponse, error)
}
type ProcessRoutersRequest struct {
model.ProcessRoutersRequest
}
type ProcessRoutersResponse struct {
model.ProcessRoutersResponse
}
type ProcessLoadBalanceRequest struct {
model.ProcessLoadBalanceRequest
}
type ProcessLoadBalanceResponse struct {
model.ProcessLoadBalanceResponse
}
// model包下的请求类型定义
type ProcessRoutersRequest struct {
// router plugins
Routers []string
// source service
SourceService ServiceInfo
// destination instances
DstInstances ServiceInstances
// invoke method
Method string
}
type ProcessRoutersResponse struct {
// instances after routing
Instances ServiceInstances
}
type ProcessLoadBalanceRequest struct {
// destination instances
DstInstances ServiceInstances
// load balance method
LbPolicy string
// hash key
HashKey string
}
type ProcessLoadBalanceResponse struct {
// instance after load balance
TargetInstance Instance
// sibling instances for target instance
SiblingInstances []Instance
}
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
有对应的issues吗?
Originally posted by @houseme in #86 (comment)
What is the feature you want to add?
sdk can use the inputed server address to do all operations, no need to relay on the polaris.discover and polaris.healthcheck
Why do you want to add this feature?
when user use sdk with the standalone server, it won't register the polaris.discover and polaris.healthcheck
How to implement this feature?
in sdk side, when user not input the service address, it won't connect to the service
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
根据实例id获取实例信息
Why do you want to add this feature?
在做kitex的实例和北极星实例转换的时候,因为北极星实例信息过多,代码强转无法满足
Describe the bug
To Reproduce
Steps to reproduce the behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
deprecate AddChangeListenerWithChannel func
Why do you want to add this feature?
AddChangeListenerWithChannel跟AddChangeListener使用场景差不多,AddChangeListener适配更多场景
How to implement this feature?
Additional context
Use AddChangeListener instead.
What is the feature you want to add?
SDK支持向配置中心写入数据
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
## 北极星SDK获取所处地理位置信息流程
背景:就近路由
新的SDK获取所处地理位置信息流程,将由两个插件组成插件链:local -> remote
#描述:全局配置项
global:
location:
providers:
- name: xxx
type: local
region: ${REGION}
zone: ${ZONE}
campus: ${CAMPUS}
- name: xxx
type: remoteHttp
region: http://127.0.0.1/region
zone: http://127.0.0.1/zone
campus: http://127.0.0.1/campus
- name: xxx
type: remoteService
address: grpc://xxx
_Originally posted by @chuntaojun in https://github.com/polarismesh/polaris/discussions/655#discussioncomment-3643039_
What is the feature you want to add?
Whether in CVM or Container, you can automatically obtain the geographic information of the cloud environment where the current SDK is located
Why do you want to add this feature?
Support the nearest routing function in the cloud environment
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
2022-09-07T09:41:20.827180Z error controller/controller.go:829 Get service instances from polaris of service [bookinfo/details] error Polaris-1006(ErrCodeServerUserError): multierrs received for GetInstances request, serviceKey: {namespace: "bookinfo", service: "details"}, cause: 1 error occurred:
* SDKError for {ServiceKey: {namespace: "bookinfo", service: "details"}, Operation: destinationInstances}, detail is Polaris-1015(ErrCodeServiceNotFound): service {namespace: "bookinfo", service: "details", event: instance} not found
太多错误,会干扰用户的判断
What is the feature you want to add?
比如,某个时候只需要注册服务和配置中心功能,这个时候是不是可以设置消费者服务不开启配置?在不需要服务消费服务时,还会生成服务发现的一些文件信息,这样会有点怪怪
Why do you want to add this feature?
实现配置信息,可以按需加载。
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
运行polaris-go里的example的circuitbreaker时崩溃报空指针错误
To Reproduce
分别运行circuitbreaker的provider 和 consumer ,运行两个provider实例,按照readme步骤测试熔断功能,先停止一个provider实例,curl 向 consumer再发起请求,consumer就崩溃了。
Expected behavior
希望能正常测试熔断功能
Environment
Additional context
分别运行circuitbreaker的provider 和 consumer ,运行两个provider实例,按照readme步骤测试熔断功能,先停止一个provider实例,curl 向 consumer再发起请求,consumer就崩溃了。
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
什么是插件,插件需要满足3个原则:
从上述2个原则来审视,以下插件需要进行调整:
alarmreporter:告警插件,用于上报告警信息,当前实现为空
需去掉,不满足原则1,因为告警一般和监控相关,且一般不由SDK直接告警,一般是监控平台进行触发
subscribe:订阅插件,用于承载用户的订阅及通知的能力
去掉,不满足原则1,SDK订阅能力通过缓存或者服务端直接驱动,并非独立功能的子模块,需挪入到主流程
cmdb:地域信息获取插件,用于提供多种获取SDK自身所在地域信息的能力
需改名,插件类型名不符合所做的事情,不满足原则2,改名为location。
同时需要增加通过服务端返回的ReportClientResponse信息解析获取地域信息的插件。
插件名需要改成:polaris_server(服务端获取),environment(环境变量获取),rest(通过调用REST接口来获取)
reporthandler:report client的请求前置处理及后置处理逻辑
需去掉,不满意原则1,插件并不是完成一个独立的功能,属于report client的一个辅助能力。
插件去掉后,相关逻辑以这种方式实现:
statreporter:完成统计监控上报的事情,当前实现为对接prometheus
需改名,插件类型名不容易懂,与业界主流概念不相符,不满足原则2,改名为metric。
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
use can config to disable local cache, then no cache dir will be created
Why do you want to add this feature?
when running unit tests, the local cache will make the package dirty, and make result confuse
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
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.