Skip to content

Commit

Permalink
Add setting to allow runtime stats to be disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Oscar Silver <[email protected]>
  • Loading branch information
Oscar Silver committed Aug 23, 2024
1 parent 3a7d0e0 commit 48364df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/server_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ func newServer(s settings.Settings, name string, statsManager stats.Manager, loc
// setup stats
ret.store = statsManager.GetStatsStore()
ret.scope = ret.store.ScopeWithTags(name, s.ExtraTags)
ret.store.AddStatGenerator(gostats.NewRuntimeStats(ret.scope.Scope("go")))
if !s.DisableRuntimeStats {
ret.store.AddStatGenerator(gostats.NewRuntimeStats(ret.scope.Scope("go")))
}
if localCache != nil {
ret.store.AddStatGenerator(limiter.NewLocalCacheStats(localCache, ret.scope.Scope("localcache")))
}
Expand Down
1 change: 1 addition & 0 deletions src/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type Settings struct {
ExtraTags map[string]string `envconfig:"EXTRA_TAGS" default:""`
StatsFlushInterval time.Duration `envconfig:"STATS_FLUSH_INTERVAL" default:"10s"`
DisableStats bool `envconfig:"DISABLE_STATS" default:"false"`
DisableRuntimeStats bool `envconfig:"DISABLE_RUNTIME_STATS" default:"false"`

// Settings for rate limit configuration
RuntimePath string `envconfig:"RUNTIME_ROOT" default:"/srv/runtime_data/current"`
Expand Down

0 comments on commit 48364df

Please sign in to comment.