polarismesh / polaris-java Goto Github PK
View Code? Open in Web Editor NEWLightweight Java SDK used as Proxyless Service Governance
License: Other
Lightweight Java SDK used as Proxyless Service Governance
License: Other
Describe the bug
https://sbom.lift.sonatype.com/report/T1-0ff0976f7f21c391f20f-59f5ee6945121c-1628144712-7bce4c6f39874d7c81bdbea1191bca6d
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?
global rateliming, all instances share one max amount
Why do you want to add this feature?
to protect the database or backend store in logical layer
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
Java Sdk 使用自定义OutlierDetector插件进行探测结果无法更新到InMemoryRegistry
To Reproduce
1、SDK内部线程池周期性执行InstancesDetectTask,默认情况下serviceKey列表为空。
@Override
public void run() {
Set<ServiceKey> services = extensions.getLocalRegistry().getServices();
for (ServiceKey serviceKey : services) {
try {
doInstanceDetectForService(serviceKey);
} catch (PolarisException e) {
LOG.error("fail to do instance detect for {}, e:{}", serviceKey, e);
}
}
}
2、选择某个Service,先getOneInstance,再updateServiceCallResult。此时serviceKey不为空,进入doInstanceDetectForService流程
3、探测的结果通过下列语句写入到InMemoryRegistry
if (MapUtils.isNotEmpty(aliveResults)) {
ServiceUpdateRequest updateRequest = buildInstanceUpdateResult(serviceKey, aliveResults);
LOG.info("update cache for outlier detect, value is {}", updateRequest);
extensions.getLocalRegistry().updateInstances(updateRequest);
}
但是发现
在buildInstanceUpdateResult时,探测结果,以key =PROPERTY_OUTLIER_DETECTOR_STATUS 保存到properites中。
properties.put(PROPERTY_OUTLIER_DETECTOR_STATUS,
new OutlierDetectionStatus(entry.getValue().getDetectType(), OutlierDetectionStatus.Status.HEALTHY,
entry.getValue().getLastDetectTime().getTime()));
但是在更新InMemoryRegistry.updateInstances时,却没有匹配不上
for (Map.Entry<String, Object> entry : properties.entrySet()) {
switch (entry.getKey()) {
case InstanceProperty.PROPERTY_CIRCUIT_BREAKER_STATUS:
onCircuitBreakStatus(entry.getValue(), instanceLocalValue, instance);
break;
case InstanceProperty.PROPERTY_DETECT_RESULT:
instanceLocalValue.setDetectResult((DetectResult) entry.getValue());
break;
default:
break;
}
}
4、导致InstancesDetectTask重复探测。
Expected behavior
理论上连续探测多次成功的探测后,就不应该再次发起。
Environment
Additional context
outlierDetection:
enable: true
checkPeriod: 10000
when: on_recover
What is the feature you want to add?
by default config, user can directly use the localhost server to do everthing, no need to register any system services
Why do you want to add this feature?
standalone version has no system services
How to implement this feature?
change the sameAsDefault as true by default
Additional context
Add any other context or screenshots about the feature request here.
北极星当前接口抛出来的异常是RumtimeException,用户程序如果不进行catch的话,会导致接口失败。传递到上层线程就会失败。
因此,接口行为建议修改如下:
需要抛异常的情况:
能提供一个nacos 接入的demo嘛,感觉demo以及案例好少呀,也没有什么文档
Describe the bug
the DefaultInternalConfigProvider has written a list of internal server ips to default config file, it may cause a security exposure of the internal assest
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.
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?
Upgrade third-party libs because current version brings in jars with CVEs .
eg:
Why do you want to add this feature?
Upgrade the version of the dependency package specified in the section .
How to implement this feature?
none .
Additional context
eg:
What is the feature you want to add?
Let's polaris support configuration center.
Why do you want to add this feature?
Polaris server had supportted dynamic configuration, so sdk should support it.
How to implement this feature?
Create an new module for configuration
Additional context
Add any other context or screenshots about the feature request here.
What is the feature you want to add?
参考这个函数:
public static InitResult initProviderConfiguration(String[] args) throws ParseException {
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?
split into 2 module as provider and consumer
and make consumer accept http request and redirect to provider
Why do you want to add this feature?
for docker deploy, you can observe the response as web server other than one way job
How to implement this feature?
use jdk8 feature to do http server
Additional context
Add any other context or screenshots about the feature request here.
when the service instance register or unregister to the polaris registry , the polaris java sdk can subscribe the event , and react to the events
What is the feature you want to add?
Let the polaris-java support multiple discovery server.
Why do you want to add this feature?
When using another discovery server and what to change to polaris, can use this feature to realize smooth migration.
How to implement this feature?
Create an composite server connector to get remote service infomation.
Additional context
No.
当前 Java SDK 的 DiscoverRequest 没有设置 revision,每次请求都会拉取全量的数据。
public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
ServiceEventKey serviceEventKey = serviceUpdateTask.getServiceEventKey();
ServiceProto.Service.Builder builder = ServiceProto.Service.newBuilder();
builder.setName(StringValue.newBuilder().setValue(serviceEventKey.getServiceKey().getService()).build());
builder.setNamespace(StringValue.newBuilder().setValue(serviceEventKey.getServiceKey().getNamespace()).build());
RequestProto.DiscoverRequest.Builder req = RequestProto.DiscoverRequest.newBuilder();
req.setType(GrpcUtil.buildDiscoverRequestType(serviceEventKey.getEventType())); // switch
req.setService(builder);
if (serviceUpdateTask.getTaskType() == Type.FIRST) {
LOG.info("[ServerConnector]send request(id={}) to {} for service {}", reqId, connection.getConnID(),
serviceEventKey);
} else {
LOG.debug("[ServerConnector]send request(id={}) to {} for service {}", reqId, connection.getConnID(),
serviceEventKey);
}
discoverClient.onNext(req.build());
}
对比 Golang SDK 传递了 revision,这样控制面就能判断是否需要返回全量数据。
// 转换为服务发现的请求对象
func (s *serviceUpdateTask) toDiscoverRequest() *namingpb.DiscoverRequest {
var request = &namingpb.DiscoverRequest{
Type: pb.GetProtoRequestType(s.Type),
Service: &namingpb.Service{
Name: &wrappers.StringValue{Value: s.Service},
Namespace: &wrappers.StringValue{Value: s.Namespace},
Revision: &wrappers.StringValue{Value: s.handler.GetRevision()},
Business: &wrappers.StringValue{Value: s.handler.GetBusiness()},
},
// 网格请求
MeshConfig: s.handler.GetMeshConfig(),
Mesh: &namingpb.Mesh{
Id: &wrappers.StringValue{Value: s.Service},
},
}
if log.GetBaseLogger().IsLevelEnabled(log.DebugLog) {
reqJson, _ := (&jsonpb.Marshaler{}).MarshalToString(request)
log.GetBaseLogger().Debugf(
"discover request to send is %s", reqJson)
}
return request
}
What is the feature you want to add?
或者polaris-java的shade包,把所有的三方依赖全部做shade
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?
在获取插件配置的时候,代码参考这里:com.tencent.polaris.factory.config.plugin.PluginConfigImpl#getPluginConfig
目前只对配置的属性值进行了缓存,每次都会通过mapper反序列化一个新的对象,是不是可以考虑把反序列化之后的对象缓存呢?
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.
java-agent需要暴露polaris.yml,agent中需要通过文件构建配置对象,然后再修改地址后传入给PolarisFacade进行初始化
当前北极星日志依赖用户的log配置,一般出现2种情况:
期望可以单独一份配置,自动嵌入到用户当前的日志框架中
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.
「推空保护」的主要场景在于,当注册中心故障或异常推送 provider 空列表时,consumer端不做更新,维持调用ip列表。
简单想了下,如果是 服务真的下线,开不开都是调用不到,那和注册中心异常两种场景下保持「推空保护」都没什么问题。
想了解下什么场景下需要关闭这个开关?
看了下读取的是consumer配置。
这样如果想单独配置某个provider维度的 推空保护关闭 就做不到了。
是不是配置在provider角度更合适?
除了服务发现需要推空保护外,其他服务治理配置、路由信息是否需要推空保护?
服务下线 和 推空保护 两个场景不冲突,但是 其他配置信息为空 和 推空保护 似乎有些冲突。
应该如何设计比较好?
What is the feature you want to add?
netty版本为4.1.75,北极星sdk依赖的netty版本为4.1.51,导致高版本的 netty在HpackDecoder处理grpc的header头调用GrpcHttp2ResponseHeaders的contains方法,而这个方法GrpcHttp2ResponseHeaders是直接抛出异常的,从而导致处理响应时抛出错误无法正常继续下面的流程
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?
如下日志显示,没有打印最新的实例信息,不利于排查问题
2022-06-27 15:00:51.671 INFO [grpc-default-executor-7576:codec.CommonHandler] resource ServiceEventKey{serviceKey=ServiceKey{namespace='prod', service=''}, eventType=INSTANCE} has updated, compare status CacheChanged, old revision is 9324c417870f06517e1cb9a45fd9fb2e692fd78b, old loadedFromFile is false, new revision is 0b7ad8cc02f16bb4b40d22590b0b67560a3d40e8
2022-06-27 15:00:51.671 INFO [grpc-default-executor-7576:memory.CacheObject] OnServiceUpdate: cache ServiceEventKey{serviceKey=ServiceKey{namespace='prod', service=''}, eventType=INSTANCE} is pending to update
2022-06-27 15:00:51.671 INFO [grpc-default-executor-7576:memory.CacheObject] CacheObject: value for ServiceEventKey{serviceKey=ServiceKey{namespace='prod', service=''}, eventType=INSTANCE} is updated, revision 0b7ad8cc02f16bb4b40d22590b0b67560a3d40e8
2022-06-27 15:00:51.671 INFO [polaris-inmemory-2:memory.MessagePersistHandler] start to save service ServiceEventKey{serviceKey=ServiceKey{namespace='prod', service=''}, eventType=INSTANCE}
2022-06-27 15:00:51.672 INFO [polaris-inmemory-2:memory.MessagePersistHandler] end to save service ServiceEventKey{serviceKey=ServiceKey{namespace='prod', service=''}, eventType=INSTANCE} to /data/app/./polaris/backup/svc#prod#xl#instance.yaml
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
When discover a service, add into the schedule pool, it will flush a log frequently to make others logs hard to find
To Reproduce
discover any of service
Expected behavior
log flush as normal , remove the useless log
Environment
Additional context
/**
* 加入调度队列
*/
public void addUpdateTaskSet() {
if (taskType.compareAndSet(Type.FIRST, Type.LONG_RUNNING)) {
targetClusterType.set(ClusterType.SERVICE_DISCOVER_CLUSTER);
grpcConnector.addLongRunningTask(this);
LOG.debug("[ServerConnector]task for service {} has been scheduled updated", this);
}
}
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.
有些场景下需要知道本次更新后instances的更新结果,可以考虑在ServiceChangeEvent中加一个list用来表示本次实例更新后有哪些instannces
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.
What is the feature you want to add?
spring cloud integrate polaris, need to get service Instances implementation to proceed with ribbon flow
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.
ERR-1006(SERVER_USER_ERROR), server error 400202: not found resource
如果服务不存在就会报这个错!
请问必须通过控制台页面创建好服务之后,才可以调用实例注册接口吗?
当前支持推模式接入pushgateway,再通过pushgateway接入prometheus,但是存在以下问题:
希望北极星可以接入原生prometheus拉取模式,当前go 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.
Describe the bug
用户配置了路由规则,假如没有传入标签,则匹配失败,无法获取实例
To Reproduce
Steps to reproduce the behavior.
Expected behavior
用户可以配置全放通规则
Environment
Additional context
Add any other context about the problem here.
What is the feature you want to add?
support Subscribe and UnSubscribe Service
Why do you want to add this feature?
support Subscribe and UnSubscribe Service
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
when grpc client plugin execute postContextInit
method, it start a task and do switchClient
operator
can someone tell me the reason of do switchClient
operator. THK!!!
Can you add publish configurations and delete configurations at ConfigFileService or ConfigFile
What is the feature you want to add?
User can define if registration or discovery enabled.
Why do you want to add this feature?
When using multi-discovery may encounter this situation.
How to implement this feature?
Add switch of registration and discovery.
Additional context
No.
目录需要重构
ratelimit-example
ratelimit-local
local-consumer
local-provider
ratelimit-global
global-consumer
global-provider
Describe the bug
replace org.apache.logging.log4j to ch.qos.logback
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.
Describe the bug
自定义探测结果 无法更新到instanceLocalValue
To Reproduce
自定义探测结果返回类型为:OutlierDetectionStatus,但是InstanceLocalValue的方法为setDetectResult(DetectResult result)
类型不一致性,更新失败
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
关联issue: polarismesh/polaris#432
用户场景:银行客户,公有云环境的链路要加密,避免数据泄露的风险。
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.