diff --git a/.env.example b/.env.example index 152283b48..a49ba120c 100644 --- a/.env.example +++ b/.env.example @@ -262,6 +262,7 @@ AZURE_APP_SECRET= # Sidekiq CloudWatch Metrics Configuration # Enable CloudWatch metrics collection for Sidekiq (Chatwoot Cloud only) +# Uses EC2 instance role for AWS credentials - no additional AWS config needed # ENABLE_SIDEKIQ_CLOUDWATCH=true # CloudWatch namespace for Sidekiq metrics (default: Chatwoot/Sidekiq) diff --git a/config/initializers/sidekiq_cloudwatch.rb b/config/initializers/sidekiq_cloudwatch.rb index ccafbdff0..871c1f8db 100644 --- a/config/initializers/sidekiq_cloudwatch.rb +++ b/config/initializers/sidekiq_cloudwatch.rb @@ -1,16 +1,8 @@ if defined?(Sidekiq::CloudWatchMetrics) && defined?(ChatwootApp) && ChatwootApp.chatwoot_cloud? && ENV['ENABLE_SIDEKIQ_CLOUDWATCH'].present? require 'sidekiq/cloudwatchmetrics' - # Configure AWS region if specified - if ENV['AWS_REGION'].present? - require 'aws-sdk-cloudwatch' - client = Aws::CloudWatch::Client.new(region: ENV['AWS_REGION']) - else - client = nil # Use default client (EC2 instance role or env credentials) - end - + # Use EC2 instance role for AWS credentials (no custom client needed) Sidekiq::CloudWatchMetrics.enable!( - client: client, namespace: ENV.fetch('SIDEKIQ_CLOUDWATCH_NAMESPACE', 'Chatwoot/Sidekiq'), interval: ENV.fetch('SIDEKIQ_CLOUDWATCH_INTERVAL', '60').to_i )