diff --git a/output/csv/output.go b/output/csv/output.go index 582ad7e52cd..c17284fe135 100644 --- a/output/csv/output.go +++ b/output/csv/output.go @@ -48,6 +48,20 @@ func newOutput(params output.Params) (*Output, error) { ignoredTags := []string{} tags := params.ScriptOptions.SystemTags.Map() for tag, flag := range tags { + systemTag, err := metrics.SystemTagString(tag) + if err != nil { + return nil, err + } + + // The non-indexable system tags are neither a "resTag" + // nor an "ignoreTag". They aren't a "resTag" as they + // aren't added as a column in the CSV. Yet they also + // shouldn't be ignored as they are added to the + // "metadata" column + if metrics.NonIndexableSystemTags.Has(systemTag) { + continue + } + if flag { resTags = append(resTags, tag) } else { diff --git a/output/csv/output_test.go b/output/csv/output_test.go index cb7166962a4..90453dfa79a 100644 --- a/output/csv/output_test.go +++ b/output/csv/output_test.go @@ -245,6 +245,7 @@ func TestRun(t *testing.T) { "url": "val2", "error": "val3", "tag4": "val4", + "vu": "1", }), }, Metadata: map[string]string{}, @@ -257,7 +258,7 @@ func TestRun(t *testing.T) { timeFormat: "", outputContent: "metric_name,timestamp,metric_value,check,error,extra_tags,metadata\n" + "my_metric,1562324643,1.000000,val1,val3,url=val2,\n" + - "my_metric,1562324644,1.000000,val1,val3,tag4=val4&url=val2,\n", + "my_metric,1562324644,1.000000,val1,val3,tag4=val4&url=val2&vu=1,\n", }, { samples: []metrics.SampleContainer{ @@ -350,7 +351,7 @@ func TestRun(t *testing.T) { Environment: env, ConfigArgument: data.fileName, ScriptOptions: lib.Options{ - SystemTags: metrics.NewSystemTagSet(metrics.TagError | metrics.TagCheck), + SystemTags: metrics.NewSystemTagSet(metrics.TagError | metrics.TagCheck | metrics.TagVU), }, }) require.NoError(t, err)