Skip to content

feat: allow developers to register external cpp plugins #2261

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ void Application::Start() { // GCOVR_EXCL_START

// plugin registration
PluginRegistry::GetInstance()->LoadPlugins();

// external plugin registration
RegisterExternalPlugins();

InputFeedbackInterfaceRegistry::GetInstance()->LoadFeedbackInterfaces();

#if defined(__ENTERPRISE__) && defined(__linux__) && !defined(__ANDROID__)
Expand Down
7 changes: 4 additions & 3 deletions core/collection_pipeline/plugin/PluginRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class PluginRegistry {
bool IsValidNativeFlusherPlugin(const std::string& name) const;
bool IsGlobalSingletonInputPlugin(const std::string& name) const;

void RegisterInputCreator(PluginCreator* creator, bool isSingleton = false);
void RegisterProcessorCreator(PluginCreator* creator);
void RegisterFlusherCreator(PluginCreator* creator, bool isSingleton = false);

private:
enum PluginCat { INPUT_PLUGIN, PROCESSOR_PLUGIN, FLUSHER_PLUGIN };

Expand All @@ -79,9 +83,6 @@ class PluginRegistry {

void LoadStaticPlugins();
void LoadDynamicPlugins(const std::set<std::string>& plugins);
void RegisterInputCreator(PluginCreator* creator, bool isSingleton = false);
void RegisterProcessorCreator(PluginCreator* creator);
void RegisterFlusherCreator(PluginCreator* creator, bool isSingleton = false);
PluginCreator* LoadProcessorPlugin(DynamicLibLoader& loader, const std::string pluginType);
void RegisterCreator(PluginCat cat, PluginCreator* creator, bool isSingleton);
std::unique_ptr<PluginInstance>
Expand Down
4 changes: 4 additions & 0 deletions core/provider/Provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ ProfileSender* GetProfileSender() {
return ProfileSender::GetInstance();
}


void RegisterExternalPlugins() {
}

} // namespace logtail
7 changes: 7 additions & 0 deletions core/provider/Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ std::vector<ConfigProvider*> GetRemoteConfigProviders();
// It currently initializes the LegacyCommonConfigProvider and CommonConfigProvider.
void InitRemoteConfigProviders();

// Deprecated:
// GetProfileSender returns the ProfileSender instance.
// Self-monitor is not sent via ProfileSender anymore.
ProfileSender* GetProfileSender();

// RegisterExternalPlugins registers the external cpp plugins.
// For example:
// PluginRegistry::GetInstance()->RegisterFlusherCreator(new StaticFlusherCreator<FlusherExternal>());
void RegisterExternalPlugins();
} // namespace logtail
Binary file modified pkg/logtail/libGoPluginAdapter.so
Binary file not shown.
Loading