little-cui commented on code in PR #316:
URL: https://github.com/apache/servicecomb-kie/pull/316#discussion_r1466389050
##########
server/metrics/prometheus.go:
##########
@@ -0,0 +1,59 @@
+package metrics
+
+import (
+ "context"
+ "os"
+ "time"
+
+ "github.com/go-chassis/go-archaius"
+ "github.com/go-chassis/go-chassis/v2/pkg/metrics"
+ "github.com/go-chassis/openlog"
+
+ "github.com/apache/servicecomb-kie/server/datasource"
+)
+
+func InitMetric() 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
+ }
+ domain, project := "", ""
+ if os.Getenv("DOMAIN") == "" {
+ domain = "default"
+ }
+ if os.Getenv("PROJECT") == "" {
+ project = "default"
+ }
Review Comment:
暂不支持环境变量,使用const变量
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]