Skip to content

Commit

Permalink
fix(cmd): respect empty SummaryTrendStats value
Browse files Browse the repository at this point in the history
Resolves: grafana@b91229a#r35621359

This changes current behavior on `master`, but as discussed above, it makes
sense to respect whatever the user specifies, so this can be considered a fix.
  • Loading branch information
Ivan Mirić authored and srguglielmo committed Nov 3, 2019
1 parent 7f63373 commit 0a4d24f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func applyDefault(conf Config) Config {
if conf.Options.SystemTags == nil {
conf = conf.Apply(Config{Options: lib.Options{SystemTags: &stats.DefaultSystemTagSet}})
}
if len(conf.Options.SummaryTrendStats) == 0 {
if conf.Options.SummaryTrendStats == nil {
conf = conf.Apply(Config{Options: lib.Options{SummaryTrendStats: lib.DefaultSummaryTrendStats}})
}
return conf
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_consolidation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func getConfigConsolidationTestCases() []configConsolidationTestCase {
assert.Equal(t, lib.DefaultSummaryTrendStats, c.Options.SummaryTrendStats)
}},
{opts{cli: []string{"--summary-trend-stats", `""`}}, exp{}, func(t *testing.T, c Config) {
assert.Equal(t, lib.DefaultSummaryTrendStats, c.Options.SummaryTrendStats)
assert.Equal(t, []string{}, c.Options.SummaryTrendStats)
}},
{
opts{runner: &lib.Options{SummaryTrendStats: []string{"avg", "p(90)", "count"}}},
Expand Down

0 comments on commit 0a4d24f

Please sign in to comment.