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

Introduce elasticsearch.ingest_pipeline.name as config option #564

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented Jun 29, 2020

In #552 elasticsearch as config block is introduced. As discussed there, it also makes sense to use this for the Ingest Pipeline config to have all Elasticsearch related parts in one place.

For now no package uses this change and Kibana does not support it. As both ways are supported, this is not a breaking change yet. As a follow up, the package generation must be updated to adjust for this option and Kibana must be adapted to only support the new option.

util/dataset.go Outdated
@@ -84,6 +85,10 @@ type Os struct {
Windows interface{} `config:"windows" json:"windows,omitempty" yaml:"windows,omitempty"`
}

type Elasticsearch struct {
IngestPipelineName string `config:"ingest_pipeline.name,omitempty" json:"ingest_pipeline.name,omitempty" yaml:"ingest_pipeline.name,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ycombinator Not 100% happy with the name yet. Any input?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just IngestPipeline is enough? Even looking at Filebeat fileset's manifest.ymls, I don't think we've ever needed to define any sub-properties of ingest pipelines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 properties for ingest pipeline I had in mind:

  • Path to the file locally
  • Name defined in the manifest instead of generated name in the package manager

That is why I made it an object to leave this door open.

@ruflin ruflin added the Ingest Management:beta1 Group issues for ingest management beta1 label Jun 29, 2020
@elasticmachine
Copy link

elasticmachine commented Jun 29, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Branch indexing]

  • Start Time: 2020-07-02T09:25:34.884+0000

  • Duration: 6 min 2 sec

Test stats 🧪

Test Results
Failed 0
Passed 81
Skipped 0
Total 81

util/dataset.go Outdated Show resolved Hide resolved
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add list of downloads to /search endpoint. [#512](https://github.com/elastic/package-registry/pull/512)
* Apply rule: first package found served. [#546](https://github.com/elastic/package-registry/pull/546)
* Implement package watcher. [#553](https://github.com/elastic/package-registry/pull/553)
* Introduce `elasticsearch.ingest_pipeline.name` as config option. [#](https://github.com/elastic/package-registry/pull/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note to the Deprecated section of the changelog about deprecating ingest_pipeline in favor of elasticsearch.ingest_pipeline?

Copy link
Contributor

@ycombinator ycombinator Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this (my previous comment) is also not needed as the old way is going away very soon?

@@ -154,7 +159,18 @@ func (d *DataSet) Validate() error {
return fmt.Errorf("type is not valid: %s", d.Type)
}

if d.IngestPipeline == "" {
if d.Elasticsearch != nil && d.Elasticsearch.IngestPipelineName == "" {
Copy link
Contributor

@ycombinator ycombinator Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is duplication of code inside this if block and it's sibling else if block. Looks like the intent is to prefer d.Elasticsearch.IngestPipelineName over d.IngestPipeline. How about defining a helper method, something like:

func (d *DataSet) ingestPipeline() string {
    if d.Elasticsearch != nil && d.Elasticsearch.IngestPipelineName != "" {
        return d.Elasticsearch.IngestPipelineName
    }

    return d.IngestPipeline
}

Then calling it here as using it's return value in the condition of the if. Then you should be able to get rid of the duplication. You could also save the return value in a local variable and use that further down wherever d.IngestPipeline is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the code goes away very soon, I kept it "delete friendly". Do you think it is still worth cleaning up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I was not aware it was going away soon when I made the clean up comment. Okay to leave it as-is.

@ycombinator
Copy link
Contributor

PR needs rebase due to conflicts.

ruflin added 3 commits July 1, 2020 15:48
In elastic#552 `elasticsearch` as config block is introduced. As discussed there, it also makes sense to use this for the Ingest Pipeline config to have all Elasticsearch related parts in one place.

For now no package uses this change and Kibana does not support it. As both ways are supported, this is not a breaking change yet. As a follow up, the package generation must be updated to adjust for this option and Kibana must be adapted to only support the new option.
@ruflin ruflin force-pushed the ingest_pipeline-addition branch from c50804e to 783ad92 Compare July 1, 2020 13:50
@ruflin ruflin marked this pull request as ready for review July 1, 2020 13:51
@ruflin
Copy link
Contributor Author

ruflin commented Jul 1, 2020

@ycombinator could you have a look at my updates and comments?

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ruflin ruflin merged commit 705d2a3 into elastic:master Jul 2, 2020
@ruflin ruflin deleted the ingest_pipeline-addition branch July 2, 2020 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ingest Management:beta1 Group issues for ingest management beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants