agent: suppose filter_default telemetry option

This commit is contained in:
Nick Ethier 2018-11-14 15:02:49 -05:00
parent 85b221a1d6
commit b81e4e18f0
No known key found for this signature in database
GPG Key ID: 07C1A3ECED90D24A
4 changed files with 18 additions and 1 deletions

View File

@ -888,6 +888,10 @@ func (c *Command) setupTelemetry(config *Config) (*metrics.InmemSink, error) {
metricsConf.AllowedPrefixes = allowedPrefixes
metricsConf.BlockedPrefixes = blockedPrefixes
if telConfig.FilterDefault != nil {
metricsConf.FilterDefault = *telConfig.FilterDefault
}
// Configure the statsite sink
var fanout metrics.FanoutSink
if telConfig.StatsiteAddr != "" {

View File

@ -444,6 +444,10 @@ type Telemetry struct {
// PrefixFilter allows for filtering out metrics from being collected
PrefixFilter []string `mapstructure:"prefix_filter"`
// FilterDefault controls whether to allow metrics that have not been specified
// by the filter
FilterDefault *bool `mapstructure:"filter_default"`
// DisableDispatchedJobSummaryMetrics allows for ignore dispatched jobs when
// publishing Job summary metrics. This is useful in environment that produce
// high numbers of single count dispatch jobs as the metrics for each take up
@ -1320,6 +1324,10 @@ func (a *Telemetry) Merge(b *Telemetry) *Telemetry {
result.PrefixFilter = b.PrefixFilter
}
if b.FilterDefault != nil {
result.FilterDefault = b.FilterDefault
}
if b.DisableDispatchedJobSummaryMetrics {
result.DisableDispatchedJobSummaryMetrics = b.DisableDispatchedJobSummaryMetrics
}

View File

@ -735,6 +735,7 @@ func parseTelemetry(result **Telemetry, list *ast.ObjectList) error {
"disable_tagged_metrics",
"backwards_compatible_metrics",
"prefix_filter",
"filter_default",
"disable_dispatched_job_summary_metrics",
}
if err := helper.CheckHCLKeys(listVal, valid); err != nil {

View File

@ -64,12 +64,16 @@ The following options are available on all telemetry configurations.
only be added to tagged metrics. Note that this option is used to transition
monitoring to tagged metrics and will eventually be deprecated.
- `disable_tagged_metrics` `(bool: false)` - Specifies if Nomad should not emit
tagged metrics and only emit metrics compatible with versions below Nomad
0.7. Note that this option is used to transition monitoring to tagged
metrics and will eventually be deprecated.
- `filter_default` `(bool: true)` - This controls whether to allow metrics that
have not been specified by the filter. Defaults to true, which will allow all
metrics when no filters are provided. When set to false with no filters, no
metrics will be sent.
- `prefix_filter` `(list: [])` - This is a list of filter rules to apply for
allowing/blocking metrics by prefix. A leading "<b>+</b>" will enable any
metrics with the given prefix, and a leading "<b>-</b>" will block them. If