Skip to content

Commit

Permalink
Add config option to add prefix to emitted metrics (cadence-workflow#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bbassingthwaite authored Feb 5, 2020
1 parent 84db9c2 commit 00961ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/service/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ type (
// Tags is the set of key-value pairs to be reported
// as part of every metric
Tags map[string]string `yaml:"tags"`
// Prefix sets the prefix to all outgoing metrics
Prefix string `yaml:"prefix"`
}

// Statsd contains the config items for statsd metrics reporter
Expand Down
3 changes: 3 additions & 0 deletions common/service/config/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (c *Metrics) newM3Scope(logger log.Logger) tally.Scope {
scopeOpts := tally.ScopeOptions{
Tags: c.Tags,
CachedReporter: reporter,
Prefix: c.Prefix,
}
scope, _ := tally.NewRootScope(scopeOpts, time.Second)
return scope
Expand All @@ -114,6 +115,7 @@ func (c *Metrics) newStatsdScope(logger log.Logger) tally.Scope {
scopeOpts := tally.ScopeOptions{
Tags: c.Tags,
Reporter: reporter,
Prefix: c.Prefix,
}
scope, _ := tally.NewRootScope(scopeOpts, time.Second)
return scope
Expand All @@ -138,6 +140,7 @@ func (c *Metrics) newPrometheusScope(logger log.Logger) tally.Scope {
CachedReporter: reporter,
Separator: prometheus.DefaultSeparator,
SanitizeOptions: &sanitizeOptions,
Prefix: c.Prefix,
}
scope, _ := tally.NewRootScope(scopeOpts, time.Second)
return scope
Expand Down

0 comments on commit 00961ac

Please sign in to comment.