From 9d8ee71fb458e7300a4f95e41b5212ae8da9e06f Mon Sep 17 00:00:00 2001 From: Keiko Oda Date: Thu, 9 Nov 2023 08:50:39 +0900 Subject: [PATCH] Add helpful logs for some common mistakes (#471) --- config/read.go | 3 +++ runner/logs.go | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/read.go b/config/read.go index 77d59eda0..ec63a37a1 100644 --- a/config/read.go +++ b/config/read.go @@ -696,6 +696,9 @@ func Read(logger *util.Logger, filename string) (Config, error) { config.SystemID, config.SystemType, config.SystemScope, config.SystemIDFallback, config.SystemTypeFallback, config.SystemScopeFallback = identifySystem(*config) conf.Servers = append(conf.Servers, *config) } else { + if os.Getenv("API_KEY") != "" { + logger.PrintInfo("Environment variable API_KEY was found, but not PGA_API_KEY. Please double check the variable name") + } return conf, fmt.Errorf("No configuration file found at %s, and no environment variables set", filename) } } diff --git a/runner/logs.go b/runner/logs.go index c80ab2e9e..775cf6780 100644 --- a/runner/logs.go +++ b/runner/logs.go @@ -397,8 +397,12 @@ func TestLogsForAllServers(ctx context.Context, servers []*state.Server, globalC } } else if server.Config.SupportsLogDownload() { success = testLogDownload(ctx, &wg, server, globalCollectionOpts, prefixedLogger) - } else if server.Config.AzureDbServerName != "" && server.Config.AzureEventhubNamespace != "" && server.Config.AzureEventhubName != "" { - success = testAzureLogStream(ctx, &wg, server, globalCollectionOpts, prefixedLogger) + } else if server.Config.AzureEventhubNamespace != "" && server.Config.AzureEventhubName != "" { + if server.Config.AzureDbServerName == "" { + prefixedLogger.PrintError("ERROR - Detected Azure Event Hub setup but azure_db_server_name is not set") + } else { + success = testAzureLogStream(ctx, &wg, server, globalCollectionOpts, prefixedLogger) + } } else if server.Config.GcpCloudSQLInstanceID != "" && server.Config.GcpPubsubSubscription != "" { success = testGoogleCloudsqlLogStream(ctx, &wg, server, globalCollectionOpts, prefixedLogger) }