Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion admin-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ func configureAdminHandler() http.Handler {
registry := prometheus.NewRegistry()
registry.MustRegister(metrics)

apiRouter.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
if helper.CONFIG.EnableUsagePush {
apiRouter.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
}

handle := RegisterHandlers(mux, handlerFns...)
return handle
Expand Down
2 changes: 2 additions & 0 deletions conf/yig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ meta_cache_type = 2
meta_store = "tidb"
tidb_info = "root:@tcp(10.5.0.17:4000)/yig"
keepalive = true
enable_usage_push = false
redis_address = "redis:6379"
redis_password = "hehehehe"
redis_connection_number = 10
Expand Down Expand Up @@ -80,3 +81,4 @@ url="s3.test.com"
[plugins.not_exist]
path = "not_exist_so"
enable = false

2 changes: 2 additions & 0 deletions helper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Config struct {
KeepAlive bool `toml:"keepalive"`

//About cache
EnableUsagePush bool `toml:"enable_usage_push"`
RedisAddress string `toml:"redis_address"` // redis connection string, e.g localhost:1234
RedisConnectionNumber int `toml:"redis_connection_number"` // number of connections to redis(i.e max concurrent request number)
RedisPassword string `toml:"redis_password"` // redis auth password
Expand Down Expand Up @@ -169,6 +170,7 @@ func MarshalTOMLConfig() error {
CONFIG.LogLevel = Ternary(len(c.LogLevel) == 0, "info", c.LogLevel).(string)
CONFIG.MetaStore = Ternary(c.MetaStore == "", "tidb", c.MetaStore).(string)

CONFIG.EnableUsagePush = c.EnableUsagePush
CONFIG.RedisAddress = c.RedisAddress
CONFIG.RedisPassword = c.RedisPassword
CONFIG.RedisConnectionNumber = Ternary(c.RedisConnectionNumber == 0,
Expand Down
1 change: 1 addition & 0 deletions integrate/yigconf/yig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ meta_cache_type = 2
meta_store = "tidb"
tidb_info = "root:@tcp(10.5.0.17:4000)/yig"
keepalive = true
enable_usage_push = false
redis_address = "redis:6379"
redis_password = "hehehehe"
redis_connection_number = 10
Expand Down