Skip to content

Add specific port detection paths to each alizer detector #1151

@thepetk

Description

@thepetk

Which area/kind this issue is related to?

/area alizer
/area documentation

Issue Description

This issue is part of the #250 EPIC and focuses on the optimization with specific paths for each detector (e.g mux_detector).

That said, after the import of the proposal for this epic (#251) we could introduce the same way for each detector for reading port detection related files:

// It returns a list of accepted paths or specific files from a given rootPath
func (b BeegoDetector) GetApplicationFileInfos(componentPath string, ctx *context.Context) []model.ApplicationFileInfo {
	return []model.ApplicationFileInfo{
		{
			Context: ctx,
			Root:    componentPath,
			Dir:     "conf",
			File:    "app.conf",
		},
	}
}

// And now on the DoPortsDetection we can directly read all potential files
func (b BeegoDetector) DoPortsDetection(component *model.Component, ctx *context.Context) {
	fileContents, err := utils.GetApplicationFileContents(b.GetApplicationFileInfos(component.Path, ctx))
	if err != nil {
		return
	}
}

Having this feature will ensure that we only parse the necessary paths for port detection.

Acceptance Criteria

  • All detectors are using the GetApplicationFileInfos function in order to fetch all files.
  • Ensure that all detectors are fetching only the necessary files for port detection.
  • Tests for new utils functions have been added.
  • The port detection documentation is up-to-date

Metadata

Metadata

Assignees

Labels

area/alizerEnhancement or issue related to the alizer repoarea/documentationImprovements or additions to documentationdemoIssue or PR candidate for a demo at the end of the Sprint

Type

No type

Projects

Status

Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions