Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aphralG committed May 20, 2024
1 parent 6f55061 commit 77bfdbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/plugin/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package plugin
import (
"log/slog"

"github.com/nginx/agent/v3/internal/resource"

"github.com/nginx/agent/v3/internal/bus"
"github.com/nginx/agent/v3/internal/config"
)
Expand All @@ -17,6 +19,7 @@ func LoadPlugins(agentConfig *config.Config, slogger *slog.Logger) []bus.Plugin

plugins = addProcessMonitor(agentConfig, plugins)
plugins = addResourceMonitor(agentConfig, plugins)
plugins = addResourcePlugin(plugins)

configPlugin := NewConfig(agentConfig)

Expand Down Expand Up @@ -60,6 +63,13 @@ func addProcessMonitor(agentConfig *config.Config, plugins []bus.Plugin) []bus.P
return plugins
}

func addResourcePlugin(plugins []bus.Plugin) []bus.Plugin {
resourcePlugin := resource.NewResource()
plugins = append(plugins, resourcePlugin)

return plugins
}

func isGrpcClientConfigured(agentConfig *config.Config) bool {
return agentConfig.Command != nil &&
agentConfig.Command.Server != nil &&
Expand Down
2 changes: 2 additions & 0 deletions internal/resource/resource_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type Resource struct {
resourceService resourceServiceInterface
}

var _ bus.Plugin = (*Resource)(nil)

func NewResource() *Resource {
return &Resource{
resourceService: NewResourceService(),
Expand Down

0 comments on commit 77bfdbf

Please sign in to comment.