TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.79k stars 2.08k forks source link

TarsGo客户端不会自动上报stat和property #765

Closed Joncer closed 3 years ago

Joncer commented 4 years ago

What language are you using?

Java go

What operating system (Linux, Ubuntu, …) and version?

Linux

What runtime / compiler are you using (e.g. jdk version or version of gcc)

jdk8,golang1.14

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

TarsGo客户端,如果不是部署在Tars框架内的话,不会自动上报state和property。而TarsJava即使不部署在Tars框架内,也会正常自动上报,这个特性还是很好用的,用到的场景也比较多,因为很多情况下,服务是不会部署在Tars框架内的。 使用的是当前最新的TarsGo release版本1.1.4,不知道有没有计划解决这一问题。

ruanshudong commented 4 years ago

你得用communicator,设置stat & property属性, 设置你上报的服务的stat, property的obj吧

Joncer commented 4 years ago

你得用communicator,设置stat & property属性, 设置你上报的服务的stat, property的obj吧

设置过了,还是不行,我也在QQ群里问了下,好像这个确实是个问题。下面这这两种方式都尝试了,还是不行。代码如下:

//communicator.Client.Stat = "tars.tarsstat.StatObj"
//communicator.Client.Property = "tars.tarsproperty.PropertyObj"
communicator.SetProperty("property", "tars.tarsproperty.PropertyObj")
communicator.SetProperty("stat", "tars.tarsstat.StatObj")

我现在添加了这段代码,给非tars客户端也添加了tars服务的配置文件,并且启动go tars.Run(),是可以上报了,但是感觉这不是一个很好的方案。代码如下:

tars.ServerConfigPath = "tars配置文件路径...."
go tars.Run()

希望之后版本可以出一个比较优雅的解决方案。

tarscloudbot commented 3 years ago

该issue长期未更新。如果问题依旧没解决,欢迎重新打开issue。TARS社区有您更精彩。

Thanks for your supporting. The issue has not been updated for a long time. If the problem is still not resolved, welcome to reopen the issue.