mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-22 04:51:24 +02: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"
|
"gotest.tools/gotestsum/testjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var GLOBAL_STATSD *statsd.Client
|
var GLOBAL_STATSD *statsd.Client = nil
|
||||||
|
|
||||||
var NUM_TEST_RETRIES map[string]int
|
var NUM_TEST_RETRIES map[string]int
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Configure Datadog
|
// 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 {
|
||||||
fmt.Printf("Skipping exporting test stats to datadog\n")
|
|
||||||
}
|
|
||||||
ddStats, err := statsd.New("localhost:8125")
|
ddStats, err := statsd.New("localhost:8125")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("failed to start DataDog statsd: %w", err)
|
err := fmt.Errorf("failed to start DataDog statsd: %w", err)
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
fmt.Printf("failed init datadog: %v", err)
|
fmt.Printf("failed to init datadog: %v", err)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
} else {
|
} else {
|
||||||
log.Fatalf("failed to init datadog: %v", err)
|
log.Fatalf("failed to init datadog: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GLOBAL_STATSD = ddStats
|
GLOBAL_STATSD = ddStats
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Skipping exporting test stats to datadog\n")
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the test output
|
// Parse the test output
|
||||||
NUM_TEST_RETRIES = make(map[string]int)
|
NUM_TEST_RETRIES = make(map[string]int)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user