-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
133035: roachtest: add code changes to benchmarks to emit openmetrics r=nameisbhaskar,DarrylWong a=sambhav-jain-16 #129221 and #132023 added changes to exporters to emit openmetrics. This PR makes changes to the roachtests to make use of the changes in the above PRs. This change also made some changes to some roachtests that use neither of the above approaches Epic: https://cockroachlabs.atlassian.net/browse/CRDB-41852 Release note: None Co-authored-by: Sambhav Jain <sambhav.jain@cockroachlabs.com>
- Loading branch information
Showing
40 changed files
with
574 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ go_library( | |
"main.go", | ||
"metadata.go", | ||
"report.go", | ||
"roachprod_util.go", | ||
"slack.go", | ||
"stage.go", | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/roachprod" | ||
"github.com/cockroachdb/cockroach/pkg/roachprod/install" | ||
"github.com/cockroachdb/cockroach/pkg/roachprod/logger" | ||
) | ||
|
||
// InitRoachprod initializes the roachprod providers by calling InitProviders. | ||
// This function sets up the environment for running roachprod commands. | ||
func InitRoachprod() { | ||
_ = roachprod.InitProviders() | ||
} | ||
|
||
// RoachprodRun runs a command on a roachprod cluster with the given cluster name and logger. | ||
// It takes a list of command arguments and passes them to the roachprod command execution. | ||
func RoachprodRun(clusterName string, l *logger.Logger, cmdArray []string) error { | ||
// Execute the roachprod command with the provided context, logger, cluster name, and options. | ||
return roachprod.Run( | ||
context.Background(), l, clusterName, "", "", false, | ||
os.Stdout, os.Stderr, cmdArray, install.DefaultRunOptions(), | ||
) | ||
} | ||
|
||
// InitLogger initializes and returns a logger based on the provided log file path. | ||
// If the logger configuration fails, the program prints an error and exits. | ||
func InitLogger(path string) *logger.Logger { | ||
loggerCfg := logger.Config{Stdout: os.Stdout, Stderr: os.Stderr} // Create a logger config with standard output and error. | ||
var loggerError error | ||
l, loggerError := loggerCfg.NewLogger(path) // Create a new logger based on the configuration. | ||
if loggerError != nil { | ||
// If there is an error initializing the logger, print the error message and exit the program. | ||
_, _ = fmt.Fprintf(os.Stderr, "unable to configure logger: %s\n", loggerError) | ||
os.Exit(1) | ||
} | ||
return l // Return the initialized logger. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.