Skip to content

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Sep 23, 2025

For #2868

Please take a look.

@efd6 efd6 self-assigned this Sep 23, 2025
@efd6 efd6 force-pushed the export_pipeline_installation branch from 9eea668 to ea3e2d9 Compare September 23, 2025 04:17
…lPipelinesInElasticsearch and GetPipelineNameWithNonce
@efd6 efd6 force-pushed the export_pipeline_installation branch from ea3e2d9 to d9ec1c6 Compare September 23, 2025 04:45
@efd6 efd6 changed the title internal/elasticsearch/ingest: export LoadIngestPipelineFiles and InstallPipelinesInElasticsearch internal/elasticsearch/ingest: export LoadIngestPipelineFiles, InstallPipelinesInElasticsearch and GetPipelineNameWithNonce Sep 23, 2025
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @efd6

@efd6 efd6 requested a review from a team September 23, 2025 05:43
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

The nonce was an implementation detail to have unique names, I wonder if this should be exposed.

I would prefer to expose an interface like the following one:

// LoadIngestPipelineFiles returns the set of pipelines found in the directory
// elasticsearch/ingest_pipeline under the provided data stream path.
LoadIngestPipelineFiles(dataStreamPath string) ([]Pipeline, error)

// GenerateUniquePipelineNames decorates pipeline names with a suffix
// to ensure they are unique.
GenerateUniquePipelineNames([]Pipeline) []Pipeline

// InstallPipelines installs the provided pipelines into the
// Elasticsearch instance specified by the provided API handle. 
InstallPipelines(ctx context.Context, api *elasticsearch.API, pipelines []Pipeline) error

This way the load and install methods can be used for any case where we need to load or install pipelines, and in the cases where we need to decorate them, we can do it with the other method.

WDYT?


func getPipelineNameWithNonce(pipelineName string, nonce int64) string {
// GetPipelineNameWithNonce returns the pipeline name decorated with the provided nonce.
func GetPipelineNameWithNonce(pipelineName string, nonce int64) string {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this method needed out of this package? The pipelines returned by LoadIngestPipelineFiles already include the nonce 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nonce is something that ideally I'd like not to exist, but it needs to. Separating them allows me to (mostly) ignore it.

All of these packages are in internal, so I don't think we need to be precious about exporting labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants