You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "tornado-ssy (via GitHub)" <gi...@apache.org> on 2024/01/23 12:25:40 UTC
[PR] support report the index of servicecomb_kie_config_count to prometheus [servicecomb-kie]
tornado-ssy opened a new pull request, #315:
URL: https://github.com/apache/servicecomb-kie/pull/315
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support report the index of servicecomb_kie_config_count to prometheus [servicecomb-kie]
Posted by "little-cui (via GitHub)" <gi...@apache.org>.
little-cui commented on code in PR #315:
URL: https://github.com/apache/servicecomb-kie/pull/315#discussion_r1464211472
##########
server/datasource/metric/prometheus.go:
##########
@@ -0,0 +1,57 @@
+package metric
+
+import (
+ "context"
+ "time"
+
+ "github.com/go-chassis/go-chassis/v2/pkg/metrics"
+ "github.com/go-chassis/openlog"
+
+ "github.com/apache/servicecomb-kie/server/config"
+ "github.com/apache/servicecomb-kie/server/datasource"
+)
+
+const ReportInterval = 15
+
+func InitMetric(m config.MetricObject) error {
Review Comment:
不应该通过定时任务来处理,而是在CRUD的svc或datasource里完成计数
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support report the index of servicecomb_kie_config_count to prometheus [servicecomb-kie]
Posted by "little-cui (via GitHub)" <gi...@apache.org>.
little-cui commented on code in PR #315:
URL: https://github.com/apache/servicecomb-kie/pull/315#discussion_r1464251236
##########
server/datasource/metric/prometheus.go:
##########
@@ -0,0 +1,57 @@
+package metric
Review Comment:
应该是server/metrics包
##########
server/config/struct.go:
##########
@@ -22,12 +22,18 @@ type Config struct {
DB DB `yaml:"db"`
RBAC RBAC `yaml:"rbac"`
Sync Sync `yaml:"sync"`
- //config from cli
+ // config from cli
ConfigFile string
NodeName string
ListenPeerAddr string
PeerAddr string
AdvertiseAddr string
+ MetricObject MetricObject `yaml:"metricObject"`
+}
+
+type MetricObject struct {
+ Domain string `yaml:"domain"`
+ Project string `yaml:"project"`
Review Comment:
不需要配置,这些通过环境变量控制即可
##########
server/datasource/metric/prometheus.go:
##########
@@ -0,0 +1,57 @@
+package metric
+
+import (
+ "context"
+ "time"
+
+ "github.com/go-chassis/go-chassis/v2/pkg/metrics"
+ "github.com/go-chassis/openlog"
+
+ "github.com/apache/servicecomb-kie/server/config"
+ "github.com/apache/servicecomb-kie/server/datasource"
+)
+
+const ReportInterval = 15
Review Comment:
这个需要可配置
##########
server/datasource/metric/prometheus.go:
##########
@@ -0,0 +1,57 @@
+package metric
+
+import (
+ "context"
+ "time"
+
+ "github.com/go-chassis/go-chassis/v2/pkg/metrics"
+ "github.com/go-chassis/openlog"
+
+ "github.com/apache/servicecomb-kie/server/config"
+ "github.com/apache/servicecomb-kie/server/datasource"
+)
+
+const ReportInterval = 15
+
+func InitMetric(m config.MetricObject) error {
+ err := metrics.CreateGauge(metrics.GaugeOpts{
+ Key: "servicecomb_kie_config_count",
+ Help: "use to show the number of config under a specifical domain and project pair",
+ Labels: []string{"domain", "project"},
+ })
+ if err != nil {
+ openlog.Error("init servicecomb_kie_config_count Gauge fail:" + err.Error())
+ return err
+ }
+ if m.Domain == "" {
+ m.Domain = "default"
+ }
+ if m.Project == "" {
+ m.Project = "default"
+ }
+ ReportTicker := time.NewTicker(ReportInterval * time.Second)
Review Comment:
局部变量命名大写开头不规范
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support report the index of servicecomb_kie_config_count to prometheus [servicecomb-kie]
Posted by "little-cui (via GitHub)" <gi...@apache.org>.
little-cui commented on code in PR #315:
URL: https://github.com/apache/servicecomb-kie/pull/315#discussion_r1464211472
##########
server/datasource/metric/prometheus.go:
##########
@@ -0,0 +1,57 @@
+package metric
+
+import (
+ "context"
+ "time"
+
+ "github.com/go-chassis/go-chassis/v2/pkg/metrics"
+ "github.com/go-chassis/openlog"
+
+ "github.com/apache/servicecomb-kie/server/config"
+ "github.com/apache/servicecomb-kie/server/datasource"
+)
+
+const ReportInterval = 15
+
+func InitMetric(m config.MetricObject) error {
Review Comment:
不应该通过定时任务来处理,而是在CRUD的svc或datasource里完成计数
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org