Skip to content

Commit

Permalink
Merge pull request #227 from mfreeman451/updates/snmp_checker_ctx
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
mfreeman451 authored Feb 20, 2025
2 parents 171343b + 0552e7b commit 79019da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/agent/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func initRegistry() checker.Registry {
})

// Register the SNMP checker
registry.Register("snmp", func(_ context.Context, _, details string) (checker.Checker, error) {
registry.Register("snmp", func(ctx context.Context, _, details string) (checker.Checker, error) {
if details == "" {
return nil, errDetailsRequiredSNMP
}

return NewSNMPChecker(details)
return NewSNMPChecker(ctx, details)
})

return registry
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/snmp_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type SNMPChecker struct {
}

// NewSNMPChecker creates a new SNMP checker that connects to an external SNMP checker process.
func NewSNMPChecker(address string) (checker.Checker, error) {
func NewSNMPChecker(ctx context.Context, address string) (checker.Checker, error) {
log.Printf("Creating new SNMP checker client for address: %s", address)

// Load configuration
Expand All @@ -51,7 +51,7 @@ func NewSNMPChecker(address string) (checker.Checker, error) {

// Create gRPC client connection to the SNMP checker process
client, err := grpc.NewClient(
context.Background(),
ctx,
address,
grpc.WithMaxRetries(grpcRetries),
)
Expand Down

0 comments on commit 79019da

Please sign in to comment.