This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 7a21c09 SCB-2176 Configurable metrics exporter (#1013)
7a21c09 is described below
commit 7a21c09371899750e3511bbdf27a2140a6feca2f
Author: little-cui <[email protected]>
AuthorDate: Wed May 26 21:21:28 2021 +0800
SCB-2176 Configurable metrics exporter (#1013)
---
etc/conf/app.yaml | 1 +
server/config/types.go | 1 +
server/rest/metrics/prometheus.go | 4 +++-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/etc/conf/app.yaml b/etc/conf/app.yaml
index 310cfc4..2422dc5 100644
--- a/etc/conf/app.yaml
+++ b/etc/conf/app.yaml
@@ -161,6 +161,7 @@ rbac:
metrics:
enable: true
interval: 30s
+ exporter: prometheus
tracing:
kind:
diff --git a/server/config/types.go b/server/config/types.go
index 46c9d7d..65efa58 100644
--- a/server/config/types.go
+++ b/server/config/types.go
@@ -53,4 +53,5 @@ func (c *AppConfig) GetPluginDir() string {
type Metrics struct {
Enable bool `yaml:"enable"`
Interval string `yaml:"interval"`
+ Exporter string `yaml:"exporter"`
}
diff --git a/server/rest/metrics/prometheus.go
b/server/rest/metrics/prometheus.go
index adc94e1..bc8f39b 100644
--- a/server/rest/metrics/prometheus.go
+++ b/server/rest/metrics/prometheus.go
@@ -23,8 +23,10 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
)
+const exporterPrometheus = "prometheus"
+
func init() {
- if !config.GetMetrics().Enable {
+ if config.GetMetrics().Exporter != exporterPrometheus {
return
}
rest.RegisterServerHandler("/metrics", promhttp.Handler())