Raj Kamal Singh 9ace374855
Feat: QS: Log Pipelines for installed integrations (#4674)
* chore: refactor: inject sqlx.DB into opamp.initDB instead of DB file name

* chore: reorganize test utils a little

* chore: add test validating pipelines for installed integrations show up in pipelines list

* chore: get basic integration pipelines testcase passing

* chore: reconcile experimental changes with latest state of develop

* chore: add integration test for reordering of pipelines

* chore: marker for integration pipelines using Id

* chore: hookup propagation of installed integration pipelines by opamp

* chore: add util for mapping slices

* chore: add support for reordering integration pipelines

* chore: exclude user saved integration pipelines if no longer installed

* chore: flesh out rest of intgeration pipelines scenarios

* chore: handle scenario when an integration is installed before any pipelines exist

* chore: notify agentConf of update after uninstalling an integration

* chore: some minor cleanup

* chore: some more cleanup

* chore: update ee server for changed controllers

* chore: some more cleanup

* chore: change builtin integration id prefix to avoid using colons that break yaml

* chore: update builtin integration id in test
2024-03-11 14:15:11 +05:30

30 lines
502 B
Go

package utils
// Map as in map-reduce.
func MapSlice[Slice ~[]Elem, Elem any, Output any](
slice Slice, mapper func(Elem) Output,
) []Output {
result := []Output{}
for _, item := range slice {
mapped := mapper(item)
result = append(result, mapped)
}
return result
}
func FilterSlice[Slice ~[]Elem, Elem any](
slice Slice, filterFn func(Elem) bool,
) Slice {
result := Slice{}
for _, item := range slice {
if filterFn(item) {
result = append(result, item)
}
}
return result
}