Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb0ab05e23 | ||
|
|
048f9877f0 | ||
|
|
5cb333d751 | ||
|
|
94dd544d82 | ||
|
|
ebfe6e8684 | ||
|
|
a5e4595def | ||
|
|
c908e28ca3 | ||
|
|
95ad9e7ffa | ||
|
|
3d8f6e0c34 | ||
|
|
863c875446 |
@@ -266,3 +266,14 @@ AZURE_APP_SECRET=
|
|||||||
# Set to true if you want to remove stale contact inboxes
|
# Set to true if you want to remove stale contact inboxes
|
||||||
# contact_inboxes with no conversation older than 90 days will be removed
|
# contact_inboxes with no conversation older than 90 days will be removed
|
||||||
# REMOVE_STALE_CONTACT_INBOX_JOB_STATUS=false
|
# REMOVE_STALE_CONTACT_INBOX_JOB_STATUS=false
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
# SIDEKIQ_CLOUDWATCH_NAMESPACE=Chatwoot/Sidekiq
|
||||||
|
|
||||||
|
# Metrics publishing interval in seconds (default: 60)
|
||||||
|
# SIDEKIQ_CLOUDWATCH_INTERVAL=60
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ gem 'sentry-sidekiq', '>= 5.19.0', require: false
|
|||||||
|
|
||||||
##-- background job processing --##
|
##-- background job processing --##
|
||||||
gem 'sidekiq', '>= 7.3.1'
|
gem 'sidekiq', '>= 7.3.1'
|
||||||
|
gem 'sidekiq-cloudwatchmetrics'
|
||||||
# We want cron jobs
|
# We want cron jobs
|
||||||
gem 'sidekiq-cron', '>= 1.12.0'
|
gem 'sidekiq-cron', '>= 1.12.0'
|
||||||
# for sidekiq healthcheck
|
# for sidekiq healthcheck
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ GEM
|
|||||||
activesupport (>= 5.0, < 7.7)
|
activesupport (>= 5.0, < 7.7)
|
||||||
aws-eventstream (1.2.0)
|
aws-eventstream (1.2.0)
|
||||||
aws-partitions (1.760.0)
|
aws-partitions (1.760.0)
|
||||||
|
aws-sdk-cloudwatch (1.73.0)
|
||||||
|
aws-sdk-core (~> 3, >= 3.165.0)
|
||||||
|
aws-sigv4 (~> 1.1)
|
||||||
aws-sdk-core (3.171.1)
|
aws-sdk-core (3.171.1)
|
||||||
aws-eventstream (~> 1, >= 1.0.2)
|
aws-eventstream (~> 1, >= 1.0.2)
|
||||||
aws-partitions (~> 1, >= 1.651.0)
|
aws-partitions (~> 1, >= 1.651.0)
|
||||||
@@ -858,6 +861,9 @@ GEM
|
|||||||
logger
|
logger
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
redis-client (>= 0.22.2)
|
redis-client (>= 0.22.2)
|
||||||
|
sidekiq-cloudwatchmetrics (2.9.0)
|
||||||
|
aws-sdk-cloudwatch (~> 1.6)
|
||||||
|
sidekiq (>= 5.0, < 9.0)
|
||||||
sidekiq-cron (1.12.0)
|
sidekiq-cron (1.12.0)
|
||||||
fugit (~> 1.8)
|
fugit (~> 1.8)
|
||||||
globalid (>= 1.0.1)
|
globalid (>= 1.0.1)
|
||||||
@@ -1099,6 +1105,7 @@ DEPENDENCIES
|
|||||||
shopify_api
|
shopify_api
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
sidekiq (>= 7.3.1)
|
sidekiq (>= 7.3.1)
|
||||||
|
sidekiq-cloudwatchmetrics
|
||||||
sidekiq-cron (>= 1.12.0)
|
sidekiq-cron (>= 1.12.0)
|
||||||
sidekiq_alive
|
sidekiq_alive
|
||||||
simplecov (>= 0.21)
|
simplecov (>= 0.21)
|
||||||
|
|||||||
@@ -15,6 +15,31 @@ Sidekiq.configure_server do |config|
|
|||||||
config[:skip_default_job_logging] = true
|
config[:skip_default_job_logging] = true
|
||||||
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
|
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Configure Sidekiq CloudWatch metrics in the server process
|
||||||
|
if ENV['ENABLE_SIDEKIQ_CLOUDWATCH'].present?
|
||||||
|
require 'sidekiq/cloudwatchmetrics'
|
||||||
|
|
||||||
|
Rails.logger.info '================================================'
|
||||||
|
Rails.logger.info 'Sidekiq::CloudWatchMetrics defined (Server Process)'
|
||||||
|
Rails.logger.info "ENV['ENABLE_SIDEKIQ_CLOUDWATCH'] #{ENV.fetch('ENABLE_SIDEKIQ_CLOUDWATCH', nil)}"
|
||||||
|
Rails.logger.info "ENV['SIDEKIQ_CLOUDWATCH_NAMESPACE'] #{ENV.fetch('SIDEKIQ_CLOUDWATCH_NAMESPACE', nil)}"
|
||||||
|
Rails.logger.info "ENV['SIDEKIQ_CLOUDWATCH_INTERVAL'] #{ENV.fetch('SIDEKIQ_CLOUDWATCH_INTERVAL', nil)}"
|
||||||
|
Rails.logger.info '================================================'
|
||||||
|
|
||||||
|
# Configure AWS CloudWatch client with explicit instance role credentials
|
||||||
|
cloudwatch_client = Aws::CloudWatch::Client.new(
|
||||||
|
region: ENV.fetch('AWS_REGION', 'us-east-1'),
|
||||||
|
credentials: Aws::InstanceProfileCredentials.new
|
||||||
|
)
|
||||||
|
|
||||||
|
# Enable Sidekiq CloudWatch metrics with the configured client
|
||||||
|
Sidekiq::CloudWatchMetrics.enable!(
|
||||||
|
namespace: ENV.fetch('SIDEKIQ_CLOUDWATCH_NAMESPACE', 'Chatwoot/Sidekiq'),
|
||||||
|
interval: ENV.fetch('SIDEKIQ_CLOUDWATCH_INTERVAL', '60').to_i,
|
||||||
|
client: cloudwatch_client
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# https://github.com/ondrejbartas/sidekiq-cron
|
# https://github.com/ondrejbartas/sidekiq-cron
|
||||||
|
|||||||
Reference in New Issue
Block a user