Skip to content

Conversation

jesson1
Copy link

@jesson1 jesson1 commented Sep 17, 2025

problem

sdk only instantiates a single Configurable by default, so adding new named pipeline functions typically requires forking or changing SDK internals — slow and hard to maintain.

solution

Introduce a configurables collection and let runtime users register their own Configurable-style providers (factories). This lets operators/apps add custom pipeline functions without rebuilding or forking the SDK.

usage

// register before pipelines are loaded (e.g. in init() or early in main)
svc.RegisterExternalConfigurable("mycfg", func(lc logger.LoggingClient, sp bootstrapInterfaces.SecretProvider) interface{} {
    return &mycfg.MyConfigurable{lc: lc, sp: sp}
})

// MyConfigurable must expose methods like:
func (m *MyConfigurable) FilterByDeviceName(params map[string]string) interfaces.AppFunction {
    // build and return an AppFunction using params
}

changes

  • add ConfigurableFactory and Service.Register/Unregister APIs
  • build configurables list from builtin + registered factories
  • iterate configurables when resolving pipeline functions

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-functions-sdk-go/blob/main/.github/CONTRIBUTING.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

New Dependency Instructions (If applicable)

@jesson1 jesson1 force-pushed the feat/configurable-provider branch 2 times, most recently from 339e00b to 593db68 Compare September 19, 2025 07:51
- add ConfigurableFactory and Service.Register/Unregister APIs
- build configurables list from builtin + registered factories
- iterate configurables when resolving pipeline functions

Signed-off-by: jiasheng.yu <[email protected]>
@jesson1 jesson1 force-pushed the feat/configurable-provider branch from 593db68 to 7dd0900 Compare September 19, 2025 07:56
@jesson1 jesson1 changed the title support multiple configurable providers feat: support multiple configurable providers Sep 19, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 52.17391% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.34%. Comparing base (5dd841c) to head (7dd0900).

Files with missing lines Patch % Lines
internal/app/service.go 46.15% 6 Missing and 1 partial ⚠️
pkg/interfaces/mocks/ApplicationService.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1749      +/-   ##
==========================================
- Coverage   48.37%   48.34%   -0.04%     
==========================================
  Files          64       64              
  Lines        4934     4952      +18     
==========================================
+ Hits         2387     2394       +7     
- Misses       2337     2347      +10     
- Partials      210      211       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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