Skip to content

Commit

Permalink
Add helpful logs for some common mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko713 committed Nov 8, 2023
1 parent b366c7f commit 3b9c8b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
8 changes: 6 additions & 2 deletions runner/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3b9c8b7

Please sign in to comment.