Move yabeda/prometheus stuff to the gem
This commit is contained in:
@@ -36,19 +36,9 @@ gem "net-http-persistent"
|
||||
gem "mittens"
|
||||
gem "useragent", bc: "useragent"
|
||||
|
||||
# Telemetry, logging, and operations
|
||||
gem "mission_control-jobs"
|
||||
gem "yabeda"
|
||||
gem "yabeda-actioncable"
|
||||
gem "yabeda-activejob", github: "basecamp/yabeda-activejob", branch: "bulk-and-scheduled-jobs"
|
||||
gem "yabeda-gc"
|
||||
gem "yabeda-http_requests"
|
||||
gem "yabeda-prometheus-mmap"
|
||||
gem "yabeda-puma-plugin"
|
||||
gem "yabeda-rails"
|
||||
gem "webrick" # required for yabeda-prometheus metrics server
|
||||
gem "prometheus-client-mmap", "~> 1.3"
|
||||
# Operations
|
||||
gem "autotuner"
|
||||
gem "mission_control-jobs"
|
||||
gem "benchmark" # indirect dependency, being removed from Ruby 3.5 stdlib so here to quash warnings
|
||||
|
||||
group :development, :test do
|
||||
|
||||
@@ -4,15 +4,6 @@ GIT
|
||||
specs:
|
||||
useragent (0.16.11)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/basecamp/yabeda-activejob.git
|
||||
revision: 684973f77ff01d8b3dd75874538fae55961e15e6
|
||||
branch: bulk-and-scheduled-jobs
|
||||
specs:
|
||||
yabeda-activejob (0.6.0)
|
||||
rails (>= 6.1)
|
||||
yabeda (~> 0.6)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails/rails.git
|
||||
revision: b22cb0c0cb39b103d816a66d560991acf0a57163
|
||||
@@ -121,8 +112,6 @@ GEM
|
||||
railties
|
||||
addressable (2.8.8)
|
||||
public_suffix (>= 2.0.2, < 8.0)
|
||||
anyway_config (2.7.2)
|
||||
ruby-next-core (~> 1.0)
|
||||
ast (2.4.3)
|
||||
autotuner (1.1.0)
|
||||
aws-eventstream (1.4.0)
|
||||
@@ -182,7 +171,6 @@ GEM
|
||||
reline (>= 0.3.8)
|
||||
dotenv (3.1.8)
|
||||
drb (2.2.3)
|
||||
dry-initializer (3.2.0)
|
||||
ed25519 (1.4.0)
|
||||
erb (6.0.0)
|
||||
erubi (1.13.1)
|
||||
@@ -318,31 +306,6 @@ GEM
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.6.0)
|
||||
prometheus-client-mmap (1.3.0)
|
||||
base64
|
||||
bigdecimal
|
||||
logger
|
||||
rb_sys (~> 0.9.117)
|
||||
prometheus-client-mmap (1.3.0-arm64-darwin)
|
||||
base64
|
||||
bigdecimal
|
||||
logger
|
||||
rb_sys (~> 0.9.117)
|
||||
prometheus-client-mmap (1.3.0-x86_64-darwin)
|
||||
base64
|
||||
bigdecimal
|
||||
logger
|
||||
rb_sys (~> 0.9.117)
|
||||
prometheus-client-mmap (1.3.0-x86_64-linux-gnu)
|
||||
base64
|
||||
bigdecimal
|
||||
logger
|
||||
rb_sys (~> 0.9.117)
|
||||
prometheus-client-mmap (1.3.0-x86_64-linux-musl)
|
||||
base64
|
||||
bigdecimal
|
||||
logger
|
||||
rb_sys (~> 0.9.117)
|
||||
propshaft (1.3.1)
|
||||
actionpack (>= 7.0.0)
|
||||
activesupport (>= 7.0.0)
|
||||
@@ -374,9 +337,6 @@ GEM
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
rainbow (3.1.1)
|
||||
rake (13.3.1)
|
||||
rake-compiler-dock (1.9.1)
|
||||
rb_sys (0.9.117)
|
||||
rake-compiler-dock (= 1.9.1)
|
||||
rdoc (6.16.0)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
@@ -419,7 +379,6 @@ GEM
|
||||
rubocop (>= 1.72)
|
||||
rubocop-performance (>= 1.24)
|
||||
rubocop-rails (>= 2.30)
|
||||
ruby-next-core (1.1.2)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby-vips (2.2.5)
|
||||
ffi (~> 1.12)
|
||||
@@ -433,9 +392,6 @@ GEM
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 4.0)
|
||||
websocket (~> 1.0)
|
||||
sniffer (0.5.0)
|
||||
anyway_config (>= 1.0)
|
||||
dry-initializer (~> 3)
|
||||
solid_cable (3.0.12)
|
||||
actioncable (>= 7.2)
|
||||
activejob (>= 7.2)
|
||||
@@ -499,7 +455,6 @@ GEM
|
||||
addressable (>= 2.8.0)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
webrick (1.9.1)
|
||||
websocket (1.2.11)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
@@ -507,33 +462,6 @@ GEM
|
||||
websocket-extensions (0.1.5)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
yabeda (0.14.0)
|
||||
anyway_config (>= 1.0, < 3)
|
||||
concurrent-ruby
|
||||
dry-initializer
|
||||
yabeda-actioncable (0.2.2)
|
||||
actioncable (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
yabeda (~> 0.8)
|
||||
yabeda-gc (0.4.0)
|
||||
yabeda (~> 0.6)
|
||||
yabeda-http_requests (0.3.0)
|
||||
anyway_config (>= 1.3, < 3.0)
|
||||
sniffer
|
||||
yabeda
|
||||
yabeda-prometheus-mmap (0.4.0)
|
||||
prometheus-client-mmap
|
||||
yabeda (~> 0.10)
|
||||
yabeda-puma-plugin (0.9.0)
|
||||
json
|
||||
puma
|
||||
yabeda (~> 0.5)
|
||||
yabeda-rails (0.10.0)
|
||||
activesupport
|
||||
anyway_config (>= 1.3, < 3)
|
||||
railties
|
||||
yabeda (~> 0.8)
|
||||
zeitwerk (2.7.3)
|
||||
|
||||
PLATFORMS
|
||||
@@ -567,7 +495,6 @@ DEPENDENCIES
|
||||
mocha
|
||||
net-http-persistent
|
||||
platform_agent
|
||||
prometheus-client-mmap (~> 1.3)
|
||||
propshaft
|
||||
puma (>= 5.0)
|
||||
rack-mini-profiler
|
||||
@@ -590,15 +517,6 @@ DEPENDENCIES
|
||||
web-console
|
||||
web-push
|
||||
webmock
|
||||
webrick
|
||||
yabeda
|
||||
yabeda-actioncable
|
||||
yabeda-activejob!
|
||||
yabeda-gc
|
||||
yabeda-http_requests
|
||||
yabeda-prometheus-mmap
|
||||
yabeda-puma-plugin
|
||||
yabeda-rails
|
||||
|
||||
BUNDLED WITH
|
||||
2.7.2
|
||||
|
||||
@@ -11,3 +11,14 @@ gem "rails_structured_logging", bc: "rails-structured-logging"
|
||||
gem "sentry-ruby"
|
||||
gem "sentry-rails"
|
||||
|
||||
# Telemetry
|
||||
gem "yabeda"
|
||||
gem "yabeda-actioncable"
|
||||
gem "yabeda-activejob", github: "basecamp/yabeda-activejob", branch: "bulk-and-scheduled-jobs"
|
||||
gem "yabeda-gc"
|
||||
gem "yabeda-http_requests"
|
||||
gem "yabeda-prometheus-mmap"
|
||||
gem "yabeda-puma-plugin"
|
||||
gem "yabeda-rails"
|
||||
gem "webrick" # required for yabeda-prometheus metrics server
|
||||
gem "prometheus-client-mmap", "~> 1.3"
|
||||
|
||||
+12
-1
@@ -1,11 +1,22 @@
|
||||
GIT
|
||||
remote: https://github.com/basecamp/fizzy-saas
|
||||
revision: 720bedaf37faf8dff18c9586e1fa7031bad1d2a9
|
||||
revision: 071e657caad9d42210d3ec3fea269a355b202395
|
||||
specs:
|
||||
fizzy-saas (0.1.0)
|
||||
prometheus-client-mmap
|
||||
queenbee
|
||||
rails (>= 8.1.0.beta1)
|
||||
rails_structured_logging
|
||||
sentry-rails
|
||||
sentry-ruby
|
||||
yabeda
|
||||
yabeda-actioncable
|
||||
yabeda-activejob
|
||||
yabeda-gc
|
||||
yabeda-http_requests
|
||||
yabeda-prometheus-mmap
|
||||
yabeda-puma-plugin
|
||||
yabeda-rails
|
||||
|
||||
GIT
|
||||
remote: https://github.com/basecamp/queenbee-plugin
|
||||
|
||||
@@ -42,8 +42,8 @@ module RequestForgeryProtection
|
||||
|
||||
Rails.logger.info "CSRF protection check: " + info.map { it.join(" ") }.join(", ")
|
||||
|
||||
if (origin && token) != sec_fetch_site
|
||||
Sentry.try :capture_message, "CSRF protection mismatch", level: :info, extra: { info: info }
|
||||
if defined?(Sentry) && (origin && token) != sec_fetch_site
|
||||
Sentry.capture_message "CSRF protection mismatch", level: :info, extra: { info: info }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,18 +7,8 @@ Autotuner.enabled = true
|
||||
# or somewhere else!
|
||||
Autotuner.reporter = proc do |report|
|
||||
Rails.logger.info "GCAUTOTUNE: #{report}"
|
||||
|
||||
if Fizzy.saas?
|
||||
Sentry.capture_message "Autotuner suggestion", level: :info, extra: { report: report.to_s }
|
||||
end
|
||||
|
||||
# # This (optional) callback is called to provide metrics that can give you
|
||||
# # insights about the performance of your app. It's recommended to send this
|
||||
# # data to your observability service (e.g. Datadog, Prometheus, New Relic, etc).
|
||||
# # Use a metric type that would allow you to calculate the average and percentiles.
|
||||
# # On Datadog this would be the distribution type. On Prometheus this would be
|
||||
# # the histogram type.
|
||||
# Autotuner.metrics_reporter = proc do |metrics|
|
||||
# # stats is a hash of metric name (string) to integer value.
|
||||
# metrics.each do |key, val|
|
||||
# StatsD.gauge(key, val)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
SolidQueue.on_start do
|
||||
Process.warmup
|
||||
|
||||
Yabeda::Prometheus::Exporter.start_metrics_server!
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
require "prometheus/client/support/puma"
|
||||
|
||||
Prometheus::Client.configuration.logger = Rails.logger
|
||||
Prometheus::Client.configuration.pid_provider = Prometheus::Client::Support::Puma.method(:worker_pid_provider)
|
||||
Yabeda::Rails.config.controller_name_case = :camel
|
||||
|
||||
Yabeda::ActiveJob.install!
|
||||
|
||||
require "yabeda/solid_queue"
|
||||
Yabeda::SolidQueue.install!
|
||||
|
||||
Yabeda::ActionCable.configure do |config|
|
||||
# Fizzy relies primarily on Turbo::StreamsChannel
|
||||
config.channel_class_name = "ActionCable::Channel::Base"
|
||||
end
|
||||
+3
-1
@@ -10,12 +10,14 @@ plugin :tmp_restart
|
||||
# Run Solid Queue with Puma
|
||||
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||
|
||||
# Expose Prometheus metrics at http://0.0.0.0:9394/metrics.
|
||||
# Expose Prometheus metrics at http://0.0.0.0:9394/metrics (SaaS only).
|
||||
# In dev, overridden to http://127.0.0.1:9306/metrics in .mise.toml.
|
||||
if Fizzy.saas?
|
||||
control_uri = Rails.env.local? ? "unix://tmp/pumactl.sock" : "auto"
|
||||
activate_control_app control_uri, no_token: true
|
||||
plugin :yabeda
|
||||
plugin :yabeda_prometheus
|
||||
end
|
||||
|
||||
if !Rails.env.local?
|
||||
# Because we expect fewer I/O waits than Rails apps that connect to the
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
module Yabeda
|
||||
module SolidQueue
|
||||
def self.install!
|
||||
Yabeda.configure do
|
||||
group :solid_queue
|
||||
|
||||
gauge :jobs_failed_count, comment: "Number of failed jobs"
|
||||
gauge :jobs_unreleased_count, comment: "Number of claimed jobs that don't belong to any process"
|
||||
gauge :jobs_scheduled_and_delayed_count, comment: "Number of scheduled jobs that have over 5 minutes delay"
|
||||
gauge :recurring_tasks_count, comment: "Number of recurring jobs scheduled"
|
||||
gauge :recurring_tasks_delayed_count, comment: "Number of recurring jobs that haven't been enqueued within their schedule"
|
||||
|
||||
collect do
|
||||
if ::SolidQueue.supervisor?
|
||||
solid_queue.jobs_failed_count.set({}, ::SolidQueue::FailedExecution.count)
|
||||
solid_queue.jobs_unreleased_count.set({}, ::SolidQueue::ClaimedExecution.where(process: nil).count)
|
||||
solid_queue.jobs_scheduled_and_delayed_count.set({}, ::SolidQueue::ScheduledExecution.where(scheduled_at: ..5.minutes.ago).count)
|
||||
solid_queue.recurring_tasks_count.set({}, ::SolidQueue::RecurringTask.count)
|
||||
solid_queue.recurring_tasks_delayed_count.set({}, ::SolidQueue::RecurringTask.count do |task|
|
||||
task.last_enqueued_time.present? && (task.previous_time - task.last_enqueued_time) > 5.minutes
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user