mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-22 22:28:51 +01:00
Reorder if in test metrics exporter so that it actually skips initializing DD when there is no DD api key
This commit is contained in:
parent
0f99c7996e
commit
d463d99916
@ -11,26 +11,27 @@ import (
|
||||
"gotest.tools/gotestsum/testjson"
|
||||
)
|
||||
|
||||
var GLOBAL_STATSD *statsd.Client
|
||||
var GLOBAL_STATSD *statsd.Client = nil
|
||||
|
||||
var NUM_TEST_RETRIES map[string]int
|
||||
|
||||
func main() {
|
||||
// Configure Datadog
|
||||
if _, has_dd_api_key := os.LookupEnv("DD_API_KEY"); !(has_dd_api_key) {
|
||||
if _, has_dd_api_key := os.LookupEnv("DD_API_KEY"); has_dd_api_key {
|
||||
ddStats, err := statsd.New("localhost:8125")
|
||||
if err != nil {
|
||||
err := fmt.Errorf("failed to start DataDog statsd: %w", err)
|
||||
if runtime.GOOS == "darwin" {
|
||||
fmt.Printf("failed to init datadog: %v", err)
|
||||
os.Exit(0)
|
||||
} else {
|
||||
log.Fatalf("failed to init datadog: %v", err)
|
||||
}
|
||||
}
|
||||
GLOBAL_STATSD = ddStats
|
||||
} else {
|
||||
fmt.Printf("Skipping exporting test stats to datadog\n")
|
||||
}
|
||||
ddStats, err := statsd.New("localhost:8125")
|
||||
if err != nil {
|
||||
err := fmt.Errorf("failed to start DataDog statsd: %w", err)
|
||||
if runtime.GOOS == "darwin" {
|
||||
fmt.Printf("failed init datadog: %v", err)
|
||||
os.Exit(0)
|
||||
} else {
|
||||
log.Fatalf("failed to init datadog: %v", err)
|
||||
}
|
||||
}
|
||||
GLOBAL_STATSD = ddStats
|
||||
|
||||
// Parse the test output
|
||||
NUM_TEST_RETRIES = make(map[string]int)
|
||||
|
Loading…
Reference in New Issue
Block a user