Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
an1l4 committed Feb 15, 2024
1 parent 32a8bf4 commit 710b78e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 70 deletions.
20 changes: 10 additions & 10 deletions agent/kubviz/k8smetrics_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"github.com/intelops/kubviz/agent/config"
"github.com/intelops/kubviz/agent/kubviz/plugins/events"
"github.com/intelops/kubviz/agent/kubviz/plugins/ketall"
"github.com/intelops/kubviz/agent/kubviz/plugins/kubepreupgrade"
//"github.com/intelops/kubviz/agent/kubviz/plugins/kubepreupgrade"

"github.com/intelops/kubviz/agent/kubviz/plugins/kuberhealthy"
//"github.com/intelops/kubviz/agent/kubviz/plugins/kubescore"
"github.com/intelops/kubviz/agent/kubviz/plugins/outdated"
"github.com/intelops/kubviz/agent/kubviz/plugins/rakkess"
//"github.com/intelops/kubviz/agent/kubviz/plugins/outdated"
//"github.com/intelops/kubviz/agent/kubviz/plugins/rakkess"

//"github.com/intelops/kubviz/agent/kubviz/plugins/trivy"
"github.com/intelops/kubviz/agent/kubviz/scheduler"
Expand Down Expand Up @@ -134,14 +134,14 @@ func main() {
}
go server.StartServer()
collectAndPublishMetrics := func() {
err := outdated.OutDatedImages(config, js)
events.LogErr(err)
err = kubepreupgrade.KubePreUpgradeDetector(config, js)
events.LogErr(err)
// err := outdated.OutDatedImages(config, js)
// events.LogErr(err)
// err = kubepreupgrade.KubePreUpgradeDetector(config, js)
// events.LogErr(err)
err = ketall.GetAllResources(config, js)
events.LogErr(err)
err = rakkess.RakeesOutput(config, js)
events.LogErr(err)
// err = rakkess.RakeesOutput(config, js)
// events.LogErr(err)
// err = trivy.RunTrivySbomScan(config, js)
// events.LogErr(err)
// err = trivy.RunTrivyImageScans(config, js)
Expand All @@ -152,7 +152,7 @@ func main() {
// events.LogErr(err)
}

collectAndPublishMetrics()
//collectAndPublishMetrics()

if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not.
scheduler := scheduler.InitScheduler(config, js, *cfg, clientset)
Expand Down
120 changes: 60 additions & 60 deletions client/pkg/clients/kubviz_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ func (n *NATSContext) SubscribeAllKubvizNats(conn clickhouse.DBInterface) {
log.Println()
},
},
{
Subject: constants.RakeesSubject,
Consumer: cfg.RakeesConsumer,
Handler: func(msg *nats.Msg) {
msg.Ack()
var metrics model.RakeesMetrics
err := json.Unmarshal(msg.Data, &metrics)
if err != nil {
log.Fatal(err)
}
log.Printf("Rakees Metrics Received: %#v,", metrics)
conn.InsertRakeesMetrics(metrics)
log.Println()
},
},
// {
// Subject: constants.RakeesSubject,
// Consumer: cfg.RakeesConsumer,
// Handler: func(msg *nats.Msg) {
// msg.Ack()
// var metrics model.RakeesMetrics
// err := json.Unmarshal(msg.Data, &metrics)
// if err != nil {
// log.Fatal(err)
// }
// log.Printf("Rakees Metrics Received: %#v,", metrics)
// conn.InsertRakeesMetrics(metrics)
// log.Println()
// },
// },
{
Subject: constants.KUBERHEALTHY_SUBJECT,
Consumer: cfg.KuberhealthyConsumer,
Expand All @@ -86,51 +86,51 @@ func (n *NATSContext) SubscribeAllKubvizNats(conn clickhouse.DBInterface) {
log.Println()
},
},
{
Subject: constants.OutdatedSubject,
Consumer: cfg.OutdatedConsumer,
Handler: func(msg *nats.Msg) {
msg.Ack()
var metrics model.CheckResultfinal
err := json.Unmarshal(msg.Data, &metrics)
if err != nil {
log.Fatal(err)
}
log.Printf("Outdated Metrics Received: %#v,", metrics)
conn.InsertOutdatedEvent(metrics)
log.Println()
},
},
{
Subject: constants.DeprecatedSubject,
Consumer: cfg.DeprecatedConsumer,
Handler: func(msg *nats.Msg) {
msg.Ack()
var metrics model.DeprecatedAPI
err := json.Unmarshal(msg.Data, &metrics)
if err != nil {
log.Fatal(err)
}
log.Printf("Deprecated API Metrics Received: %#v,", metrics)
conn.InsertDeprecatedAPI(metrics)
log.Println()
},
},
{
Subject: constants.DeletedSubject,
Consumer: cfg.DeletedConsumer,
Handler: func(msg *nats.Msg) {
msg.Ack()
var metrics model.DeletedAPI
err := json.Unmarshal(msg.Data, &metrics)
if err != nil {
log.Fatal(err)
}
log.Printf("Deleted API Metrics Received: %#v,", metrics)
conn.InsertDeletedAPI(metrics)
log.Println()
},
},
// {
// Subject: constants.OutdatedSubject,
// Consumer: cfg.OutdatedConsumer,
// Handler: func(msg *nats.Msg) {
// msg.Ack()
// var metrics model.CheckResultfinal
// err := json.Unmarshal(msg.Data, &metrics)
// if err != nil {
// log.Fatal(err)
// }
// log.Printf("Outdated Metrics Received: %#v,", metrics)
// conn.InsertOutdatedEvent(metrics)
// log.Println()
// },
// },
// {
// Subject: constants.DeprecatedSubject,
// Consumer: cfg.DeprecatedConsumer,
// Handler: func(msg *nats.Msg) {
// msg.Ack()
// var metrics model.DeprecatedAPI
// err := json.Unmarshal(msg.Data, &metrics)
// if err != nil {
// log.Fatal(err)
// }
// log.Printf("Deprecated API Metrics Received: %#v,", metrics)
// conn.InsertDeprecatedAPI(metrics)
// log.Println()
// },
// },
// {
// Subject: constants.DeletedSubject,
// Consumer: cfg.DeletedConsumer,
// Handler: func(msg *nats.Msg) {
// msg.Ack()
// var metrics model.DeletedAPI
// err := json.Unmarshal(msg.Data, &metrics)
// if err != nil {
// log.Fatal(err)
// }
// log.Printf("Deleted API Metrics Received: %#v,", metrics)
// conn.InsertDeletedAPI(metrics)
// log.Println()
// },
// },
// {
// Subject: constants.TRIVY_IMAGE_SUBJECT,
// Consumer: cfg.TrivyImageConsumer,
Expand Down

0 comments on commit 710b78e

Please sign in to comment.