Skip to content

Commit

Permalink
Fix index subcommands to append jobName and uuid (kube-burner#496)
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Oct 19, 2023
1 parent 71a4ba5 commit 6ffa7e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/prometheus/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type Prometheus struct {
type Job struct {
Start time.Time
End time.Time
Name string
JobConfig config.Job
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/util/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/alerting"
"github.com/cloud-bulldozer/kube-burner/pkg/config"
"github.com/cloud-bulldozer/kube-burner/pkg/prometheus"
"github.com/cloud-bulldozer/kube-burner/pkg/util"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -111,7 +112,9 @@ func ProcessMetricsScraperConfig(metricsScraperConfig ScraperConfig) Scraper {
p.JobList = []prometheus.Job{{
Start: time.Unix(metricsScraperConfig.StartTime, 0),
End: time.Unix(metricsScraperConfig.EndTime, 0),
Name: metricsScraperConfig.JobName,
JobConfig: config.Job{
Name: metricsScraperConfig.JobName,
},
},
}
p.ScrapeJobsMetrics(indexer)
Expand Down
5 changes: 3 additions & 2 deletions pkg/workloads/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewIndex(metricsEndpoint *string, metadata *BenchmarkMetadata, ocpMetaAgent
Long: "If no other indexer is specified, local indexer is used by default",
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
uuid, _ = cmd.Flags().GetString("uuid")
uuid, _ = cmd.InheritedFlags().GetString("uuid")
},
PostRun: func(cmd *cobra.Command, args []string) {
log.Info("👋 Exiting kube-burner ", uuid)
Expand All @@ -58,6 +58,7 @@ func NewIndex(metricsEndpoint *string, metadata *BenchmarkMetadata, ocpMetaAgent
}
esServer, _ := cmd.Flags().GetString("es-server")
esIndex, _ := cmd.Flags().GetString("es-index")
configSpec.GlobalConfig.UUID = uuid
if esServer != "" && esIndex != "" {
configSpec.GlobalConfig.IndexerConfig = indexers.IndexerConfig{
Type: indexers.ElasticIndexer,
Expand Down Expand Up @@ -87,7 +88,7 @@ func NewIndex(metricsEndpoint *string, metadata *BenchmarkMetadata, ocpMetaAgent
Token: prometheusToken,
StartTime: start,
EndTime: end,
JobName: jobName + "-" + uuid,
JobName: jobName,
ActionIndex: true,
UserMetaData: userMetadata,
OcpMetaData: ocpMetadata,
Expand Down

0 comments on commit 6ffa7e1

Please sign in to comment.