feat: support log level in cmp plugin, possibility to trace generated manifest (#18851)

* feat: support log level in cmp plugin, and add possibility to trace generated manifest

Signed-off-by: pashakostohrys <pavel@codefresh.io>

* feat: support log level in cmp plugin, and add possibility to trace generated manifest

Signed-off-by: pashakostohrys <pavel@codefresh.io>

---------

Signed-off-by: pashakostohrys <pavel@codefresh.io>
This commit is contained in:
pasha-codefresh 2024-06-30 22:49:07 +03:00 committed by GitHub
parent 9b3a4d150d
commit 1aa898cbb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -81,8 +81,8 @@ func NewCommand() *cobra.Command {
},
}
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", env.StringFromEnv("ARGOCD_CMP_SERVER_LOGFORMAT", "text"), "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", env.StringFromEnv("ARGOCD_CMP_SERVER_LOGLEVEL", "info"), "Set the logging level. One of: trace|debug|info|warn|error")
command.Flags().StringVar(&configFilePath, "config-dir-path", common.DefaultPluginConfigFilePath, "Config management plugin configuration file location, Default is '/home/argocd/cmp-server/config/'")
command.Flags().StringVar(&otlpAddress, "otlp-address", env.StringFromEnv("ARGOCD_CMP_SERVER_OTLP_ADDRESS", ""), "OpenTelemetry collector address to send traces to")
command.Flags().BoolVar(&otlpInsecure, "otlp-insecure", env.ParseBoolFromEnv("ARGOCD_CMP_SERVER_OTLP_INSECURE", true), "OpenTelemetry collector insecure mode")

View file

@ -240,6 +240,9 @@ func (s *Service) generateManifestGeneric(stream GenerateManifestStream) error {
if err != nil {
return fmt.Errorf("error generating manifests: %w", err)
}
log.Tracef("Generated manifests result: %s", response.Manifests)
err = stream.SendAndClose(response)
if err != nil {
return fmt.Errorf("error sending manifest response: %w", err)