Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional CSV archiving #140

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions cmd/k8s-netperf/k8s-netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var (
tcpt float64
json bool
version bool
csvArchive bool
)

var rootCmd = &cobra.Command{
Expand Down Expand Up @@ -268,19 +269,16 @@ var rootCmd = &cobra.Command{
log.Error(err)
}
}
err = archive.WriteCSVResult(sr)
if err != nil {
log.Fatal(err)
}
if pavail {
err = archive.WritePromCSVResult(sr)
if err != nil {
if csvArchive {
if archive.WriteCSVResult(sr) != nil {
log.Fatal(err)
}
if pavail && archive.WritePromCSVResult(sr) != nil {
log.Fatal(err)
}
if archive.WriteSpecificCSV(sr) != nil {
log.Fatal(err)
}
}
err = archive.WriteSpecificCSV(sr)
if err != nil {
log.Fatal(err)
}
// Initially we are just checking against TCP_STREAM results.
retCode := 0
Expand Down Expand Up @@ -457,6 +455,7 @@ func main() {
rootCmd.Flags().BoolVar(&showMetrics, "metrics", false, "Show all system metrics retrieved from prom")
rootCmd.Flags().Float64Var(&tcpt, "tcp-tolerance", 10, "Allowed %diff from hostNetwork to podNetwork, anything above tolerance will result in k8s-netperf exiting 1.")
rootCmd.Flags().BoolVar(&version, "version", false, "k8s-netperf version")
rootCmd.Flags().BoolVar(&csvArchive, "csv", true, "Archive results, cluster and benchmark metrics in CSV files")
rootCmd.Flags().SortFlags = false
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
Expand Down
Loading