Skip to content

Commit

Permalink
do not filter Go checks to ensure the disk checks runs on Python\
Browse files Browse the repository at this point in the history
add more logging information
  • Loading branch information
GustavoCaso committed Jan 9, 2025
1 parent f7ad437 commit cba7c51
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmd/checks-agent/subcommands/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func startScheduler(ctx context.Context, f context.CancelFunc, client core.Agent
continue
}
}
fmt.Printf("autodiscoveryStream: %+v\n", autodiscoveryStream.autodiscoveryStream)
log.Infof("autodiscoveryStream: %+v\n", autodiscoveryStream.autodiscoveryStream)

streamConfigs, err := autodiscoveryStream.autodiscoveryStream.Recv()

Expand Down
39 changes: 24 additions & 15 deletions comp/core/autodiscovery/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
package stream

import (
"slices"
"strings"
"time"

"github.com/google/uuid"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery"
"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/autodiscovery/proto"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks"
pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core"
"github.com/DataDog/datadog-agent/pkg/util/grpc"
"github.com/DataDog/datadog-agent/pkg/util/log"
Expand Down Expand Up @@ -49,11 +48,21 @@ type scheduler struct {
done chan error
}

func (s *scheduler) Schedule(config []integration.Config) {
s.handleEvent(config, pb.ConfigEventType_SCHEDULE)
func (s *scheduler) Schedule(configs []integration.Config) {
names := make([]string, len(configs))
for i, config := range configs {
names[i] = config.Name
}
log.Infof("sending schedule autodiscovery event with config names: %s", strings.Join(names, ", "))
s.handleEvent(configs, pb.ConfigEventType_SCHEDULE)
}

func (s *scheduler) Unschedule(configs []integration.Config) {
names := make([]string, len(configs))
for i, config := range configs {
names[i] = config.Name
}
log.Infof("sending unschedule autodiscovery event with config names: %s", strings.Join(names, ", "))
s.handleEvent(configs, pb.ConfigEventType_UNSCHEDULE)
}

Expand All @@ -62,7 +71,7 @@ func (s *scheduler) Stop() {
}

func (s *scheduler) handleEvent(configs []integration.Config, eventType pb.ConfigEventType) {
configs = filterOutGoConfigs(configs)
// configs = filterOutGoConfigs(configs)

protobufConfigs := protobufConfigFromAutodiscoveryConfigs(configs, eventType)

Expand All @@ -82,16 +91,16 @@ func (s *scheduler) handleEvent(configs []integration.Config, eventType pb.Confi
}
}

func filterOutGoConfigs(configs []integration.Config) []integration.Config {
goChecksNames := corechecks.GetRegisteredFactoryKeys()
res := make([]integration.Config, 0, len(configs))
for _, c := range configs {
if !slices.Contains(goChecksNames, c.Name) {
res = append(res, c)
}
}
return res
}
// func filterOutGoConfigs(configs []integration.Config) []integration.Config {
// goChecksNames := corechecks.GetRegisteredFactoryKeys()
// res := make([]integration.Config, 0, len(configs))
// for _, c := range configs {
// if !slices.Contains(goChecksNames, c.Name) {
// res = append(res, c)
// }
// }
// return res
// }

func protobufConfigFromAutodiscoveryConfigs(config []integration.Config, eventType pb.ConfigEventType) []*pb.Config {
res := make([]*pb.Config, 0, len(config))
Expand Down

0 comments on commit cba7c51

Please sign in to comment.