Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable overwriting ingest pipelines by default. #2452

Merged
merged 4 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _meta/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ apm-server:
#register.ingest.pipeline:
# Registers APM pipeline definition in Elasticsearch on APM Server startup. Defaults to true.
#enabled: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to true.
#overwrite: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to false.
#overwrite: false

# When ilm is set to `auto`, the APM Server checks a couple of preconditions:
# If a different output than Elasticsearch is configured, ILM will be disabled.
Expand Down
4 changes: 2 additions & 2 deletions apm-server.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ apm-server:
#register.ingest.pipeline:
# Registers APM pipeline definition in Elasticsearch on APM Server startup. Defaults to true.
#enabled: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to true.
#overwrite: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to false.
#overwrite: false

# When ilm is set to `auto`, the APM Server checks a couple of preconditions:
# If a different output than Elasticsearch is configured, ILM will be disabled.
Expand Down
4 changes: 2 additions & 2 deletions apm-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ apm-server:
#register.ingest.pipeline:
# Registers APM pipeline definition in Elasticsearch on APM Server startup. Defaults to true.
#enabled: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to true.
#overwrite: true
# Overwrites existing APM pipeline definition in Elasticsearch. Defaults to false.
#overwrite: false

# When ilm is set to `auto`, the APM Server checks a couple of preconditions:
# If a different output than Elasticsearch is configured, ILM will be disabled.
Expand Down
5 changes: 2 additions & 3 deletions beater/beater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ func TestBeatConfig(t *testing.T) {
Register: &registerConfig{
Ingest: &ingestConfig{
Pipeline: &pipelineConfig{
Enabled: &falsy,
Overwrite: &truthy,
Path: filepath.Join("ingest", "pipeline", "definition.json"),
Enabled: &falsy,
Path: filepath.Join("ingest", "pipeline", "definition.json"),
},
},
},
Expand Down
5 changes: 2 additions & 3 deletions beater/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (c *pipelineConfig) isEnabled() bool {
}

func (c *pipelineConfig) shouldOverwrite() bool {
return c != nil && (c.Overwrite == nil || *c.Overwrite)
return c != nil && (c.Overwrite != nil && *c.Overwrite)
}

func (c *rumConfig) memoizedSmapMapper() (sourcemap.Mapper, error) {
Expand Down Expand Up @@ -281,8 +281,7 @@ func defaultConfig(beatVersion string) *Config {
Register: &registerConfig{
Ingest: &ingestConfig{
Pipeline: &pipelineConfig{
Enabled: &pipeline,
Overwrite: &pipeline,
Enabled: &pipeline,
Path: paths.Resolve(paths.Home,
filepath.Join("ingest", "pipeline", "definition.json")),
}},
Expand Down
2 changes: 1 addition & 1 deletion beater/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestPipeline(t *testing.T) {
enabled, overwrite bool
}{
{c: nil, enabled: false, overwrite: false},
{c: &pipelineConfig{}, enabled: true, overwrite: true}, //default values
{c: &pipelineConfig{}, enabled: true, overwrite: false}, //default values
{c: &pipelineConfig{Enabled: &falsy, Overwrite: &truthy},
enabled: false, overwrite: true},
{c: &pipelineConfig{Enabled: &truthy, Overwrite: &falsy},
Expand Down
4 changes: 2 additions & 2 deletions changelogs/7.2.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ https://github.com/elastic/apm-server/compare/7.1\...7.2[View commits]
https://github.com/elastic/apm-server/compare/v7.2.0\...v7.2.1[View commits]

[float]
==== Bug fixes
- Set `apm-server.register.ingest.pipeline.overwrite` to true by default {pull}2273[2273].
==== Known issues
- `apm-server.register.ingest.pipeline.overwrite` set to true by default {pull}[].
simitt marked this conversation as resolved.
Show resolved Hide resolved

[[release-notes-7.2.0]]
=== APM Server version 7.2.0
Expand Down
1 change: 0 additions & 1 deletion changelogs/7.3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ https://github.com/elastic/apm-server/compare/v7.2.1\...v7.3.0[View commits]

[float]
==== Bug fixes
- Set `apm-server.register.ingest.pipeline.overwrite` to true by default {pull}2273[2273].
- Abort server startup on sourcemap configuration error {pull}2278[2278].
- Process all user-agent information from headers {pull}2271[2271].

Expand Down
37 changes: 29 additions & 8 deletions tests/system/test_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ def test_setup_pipelines(self):
assert self.log_contains("No pipeline callback registered")


# APM Server `run`

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
class PipelineDefaultTest(ElasticTest):
# pipeline.overwrite enabled by default.

class PipelineRegisterTest(ElasticTest):
def test_default_pipelines_registered(self):
pipelines = [
("apm_user_agent", "Add user agent information for APM events"),
Expand Down Expand Up @@ -159,13 +154,14 @@ def test_pipeline_not_registered(self):


@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
class PipelineDisableRegisterOverwriteTest(ElasticTest):
class PipelineDefaultDisableRegisterOverwriteTest(ElasticTest):

config_overrides = {
"register_pipeline_overwrite": "false"
}

def setUp(self):
super(PipelineDisableRegisterOverwriteTest, self).setUp()
super(PipelineDefaultDisableRegisterOverwriteTest, self).setUp()
es = Elasticsearch([self.get_elasticsearch_url()])
# Write empty default pipeline
es.ingest.put_pipeline(
Expand All @@ -176,3 +172,28 @@ def setUp(self):
def test_pipeline_not_overwritten(self):
loaded_msg = "Pipeline already registered"
self.wait_until(lambda: self.log_contains(loaded_msg))


@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
class PipelineEnableRegisterOverwriteTest(ElasticTest):

simitt marked this conversation as resolved.
Show resolved Hide resolved
config_overrides = {
"register_pipeline_overwrite": "true"
}

def setUp(self):
super(PipelineEnableRegisterOverwriteTest, self).setUp()
es = Elasticsearch([self.get_elasticsearch_url()])
# Write empty default pipeline
es.ingest.put_pipeline(
id="apm",
body={"description": "empty apm test pipeline", "processors": []})
self.wait_until(lambda: es.ingest.get_pipeline("apm"))

def test_pipeline_overwritten(self):
loaded_msg = "Pipeline successfully registered"
self.wait_until(lambda: self.log_contains(loaded_msg))
pipeline_id = "apm"
pipeline = self.wait_until(lambda: self.es.ingest.get_pipeline(id=pipeline_id),
name="fetching pipeline {}".format(pipeline_id))
assert pipeline[pipeline_id]['description'] == "Default enrichment for APM events"