From a6b13a1b3ea24772ae1149fd74a581544314fb5c Mon Sep 17 00:00:00 2001 From: jt-dd Date: Thu, 14 Nov 2024 18:32:43 +0100 Subject: [PATCH] readding events --- pkg/kubehound/core/core_grpc_api.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/kubehound/core/core_grpc_api.go b/pkg/kubehound/core/core_grpc_api.go index 23a1b19a..ad9f1e9c 100644 --- a/pkg/kubehound/core/core_grpc_api.go +++ b/pkg/kubehound/core/core_grpc_api.go @@ -10,6 +10,7 @@ import ( "github.com/DataDog/KubeHound/pkg/ingestor/notifier/noop" "github.com/DataDog/KubeHound/pkg/ingestor/puller/blob" "github.com/DataDog/KubeHound/pkg/kubehound/providers" + "github.com/DataDog/KubeHound/pkg/telemetry/events" "github.com/DataDog/KubeHound/pkg/telemetry/log" "github.com/DataDog/KubeHound/pkg/telemetry/span" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" @@ -46,18 +47,18 @@ func initCoreGrpcApi(ctx context.Context, khCfg *config.KubehoundConfig) (*api.I } func CoreGrpcApi(ctx context.Context, khCfg *config.KubehoundConfig) error { - ingestorApi, _ := initCoreGrpcApi(ctx, khCfg) + ingestorApi, err := initCoreGrpcApi(ctx, khCfg) + if err != nil { + _ = events.PushEvent(ctx, events.IngestorFailed, "") + + return err + } defer ingestorApi.Close(ctx) - // TODO: need to merge fix-observability branch to get the following events - // if err != nil { - // events.PushEventIngestorFailed(ctx) - // return err - // } - // events.PushEventIngestorInit(ctx) + _ = events.PushEvent(ctx, events.IngestorInit, "") l := log.Logger(ctx) l.Info("Starting Ingestor API") - err := grpc.Listen(ctx, ingestorApi) + err = grpc.Listen(ctx, ingestorApi) if err != nil { return err }