Skip to content

Commit

Permalink
metrics-profile flag implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Sep 25, 2024
1 parent f4799cd commit c8a5562
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion cluster-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
var churnDelay, churnDuration time.Duration
var churnDeletionStrategy string
var podReadyThreshold time.Duration
var metricsProfile []string
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand Down Expand Up @@ -60,7 +61,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
log.Errorf("image-registry deployment is not deployed")
}
}
setMetrics(cmd, "metrics-aggregated.yml")
setMetrics(cmd, metricsProfile...)
wh.Run(cmd.Name())
},
}
Expand All @@ -73,6 +74,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
cmd.Flags().IntVar(&churnPercent, "churn-percent", 10, "Percentage of job iterations that kube-burner will churn each round")
cmd.Flags().StringVar(&churnDeletionStrategy, "churn-deletion-strategy", "default", "Churn deletion strategy to use")
cmd.Flags().BoolVar(&svcLatency, "service-latency", false, "Enable service latency measurement")
cmd.Flags().StringSliceVar(&metricsProfile, "metrics-profile", []string{"metrics-aggregated.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagRequired("iterations")
return cmd
}
7 changes: 2 additions & 5 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ import (

var clusterMetadata ocpmetadata.ClusterMetadata

func setMetrics(cmd *cobra.Command, metricsProfile string) {
var metricsProfiles []string
func setMetrics(cmd *cobra.Command, metricsProfiles ...string) {
profileType, _ := cmd.Root().PersistentFlags().GetString("profile-type")
switch ProfileType(profileType) {
case Reporting:
metricsProfiles = []string{"metrics-report.yml"}
case Regular:
metricsProfiles = []string{metricsProfile}
case Both:
metricsProfiles = []string{"metrics-report.yml", metricsProfile}
metricsProfiles = append(metricsProfiles, "metrics-report.yml")
}
os.Setenv("METRICS", strings.Join(metricsProfiles, ","))
}
Expand Down

0 comments on commit c8a5562

Please sign in to comment.