Skip to content

Commit

Permalink
remove metricsclient
Browse files Browse the repository at this point in the history
  • Loading branch information
gamoutatsumi committed Apr 25, 2024
1 parent 3b1a73f commit 0cdc3c4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pool-agent/cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Agent struct {
ResourceTypesMap []ResourceTypesMap
ResourceTypesCounts ResourceTypesCounts
Client lxd.InstanceServer
MetricsClient lxd.InstanceServer

CheckInterval time.Duration
WaitIdleTime time.Duration
Expand Down Expand Up @@ -57,10 +56,6 @@ func newAgent(ctx context.Context) (*Agent, error) {
if err != nil {
return nil, fmt.Errorf("connect lxd: %w", err)
}
mc, err := lxd.ConnectLXDUnixWithContext(ctx, "", &lxd.ConnectionArgs{})
if err != nil {
return nil, fmt.Errorf("connect lxd: %w", err)
}
checkInterval, waitIdleTime, zombieAllowTime, err := LoadParams()
if err != nil {
return nil, fmt.Errorf("load params: %w", err)
Expand All @@ -83,7 +78,6 @@ func newAgent(ctx context.Context) (*Agent, error) {
ResourceTypesMap: conf.ResourceTypesMap,
ResourceTypesCounts: conf.ResourceTypesCounts,
Client: c,
MetricsClient: mc,

CheckInterval: checkInterval,
WaitIdleTime: waitIdleTime,
Expand Down Expand Up @@ -276,7 +270,7 @@ func (a *Agent) CollectMetrics(ctx context.Context) error {
}

func (a *Agent) collectMetrics() error {
s, err := a.MetricsClient.GetInstances(api.InstanceTypeAny)
s, err := a.Client.GetInstances(api.InstanceTypeAny)
if err != nil {
return fmt.Errorf("get instances: %w", err)
}
Expand Down

0 comments on commit 0cdc3c4

Please sign in to comment.