Skip to content

Commit

Permalink
Remove default docker pipeline stage - this is undocumented and unexp…
Browse files Browse the repository at this point in the history
…ected behaviour (#3404)

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
  • Loading branch information
Danny Kopping authored Mar 1, 2021
1 parent 0f881fb commit faa1eab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 1 addition & 5 deletions pkg/promtail/scrapeconfig/scrapeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,7 @@ type PushTargetConfig struct {

// DefaultScrapeConfig is the default Config.
var DefaultScrapeConfig = Config{
PipelineStages: []interface{}{
map[interface{}]interface{}{
stages.StageTypeDocker: nil,
},
},
PipelineStages: stages.PipelineStages{},
}

// HasServiceDiscoveryConfig checks to see if the service discovery used for
Expand Down
21 changes: 21 additions & 0 deletions pkg/promtail/scrapeconfig/scrapeconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ relabel_configs:
target_label: __path__
`

var noPipelineStagesYaml = `
job_name: kubernetes-pods-name
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
kubernetes_sd_configs:
- role: pod
`

func TestLoadSmallConfig(t *testing.T) {
var config Config
err := yaml.Unmarshal([]byte(smallYaml), &config)
Expand Down Expand Up @@ -109,6 +121,15 @@ func TestLoadSmallConfig(t *testing.T) {
require.Equal(t, expected, config)
}

// bugfix: https://github.com/grafana/loki/issues/3403
func TestEmptyPipelineStagesConfig(t *testing.T) {
var config Config
err := yaml.Unmarshal([]byte(noPipelineStagesYaml), &config)
require.Nil(t, err)

require.Zero(t, len(config.PipelineStages))
}

func TestLoadConfig(t *testing.T) {
var config Config
err := yaml.Unmarshal([]byte(testYaml), &config)
Expand Down

0 comments on commit faa1eab

Please sign in to comment.