Commit 0bbc16f5 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Make metrics prefix configurable, default to fixed value.

parent 8929782f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Changed
- Make metrics prefix configurable, default to fixed value.

### Fixed
- Better handling of SSL connections in development configurations.
- Use correct error message and response code when RPC functions receive a request payload larger than allowed.
+2 −0
Original line number Diff line number Diff line
@@ -508,6 +508,7 @@ type MetricsConfig struct {
	ReportingFreqSec int    `yaml:"reporting_freq_sec" json:"reporting_freq_sec" usage:"Frequency of metrics exports. Default is 60 seconds."`
	Namespace        string `yaml:"namespace" json:"namespace" usage:"Namespace for Prometheus metrics. It will always prepend node name."`
	PrometheusPort   int    `yaml:"prometheus_port" json:"prometheus_port" usage:"Port to expose Prometheus. If '0' Prometheus exports are disabled."`
	Prefix           string `yaml:"prefix" json:"prefix" usage:"Prefix for metric names. Default is 'nakama', empty string '' disables the prefix."`
}

// NewMetricsConfig creates a new MatricsConfig struct.
@@ -516,6 +517,7 @@ func NewMetricsConfig() *MetricsConfig {
		ReportingFreqSec: 60,
		Namespace:        "",
		PrometheusPort:   0,
		Prefix:           "nakama",
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ func NewMetrics(logger, startupLogger *zap.Logger, config Config) *Metrics {
		tags["namespace"] = namespace
	}
	m.prometheusScope, m.prometheusCloser = tally.NewRootScope(tally.ScopeOptions{
		Prefix:          config.GetName(),
		Prefix:          config.GetMetrics().Prefix,
		Tags:            tags,
		CachedReporter:  reporter,
		Separator:       prometheus.DefaultSeparator,