-
-
Notifications
You must be signed in to change notification settings - Fork 534
Description
Description
Yabeda is a popular Ruby metrics framework that uses an adapter pattern to decouple metric declaration from the backend. There are existing adapters for Prometheus, Datadog, NewRelic, and StatsD ➡️ but currently nothing for Sentry.
yabeda-sentry gem that implements Yabeda::BaseAdapter and forwards to Sentry.metrics.
Setup would look like this:
# Gemfile
gem "yabeda-sentry"
gem "yabeda-rails" # optional plugins as usual
gem "yabeda-sidekiq"
# config/initializers/sentry.rb
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.enable_metrics = true
end
# config/initializers/yabeda.rb
require "yabeda-sentry"
Yabeda.configure do
group :myapp do
counter :orders_created, comment: "Orders placed", tags: %i[region payment_method]
gauge :queue_depth, comment: "Jobs waiting", tags: %i[queue_name]
histogram :response_time, comment: "HTTP response time", unit: :milliseconds, tags: %i[controller action]
end
endApplication code stays untouched, metrics flow to Sentry automatically.
Mapping:
counter=>Sentry.metrics.count(1:1)gauge=>Sentry.metrics.gauge(1:1)histogram/summary=>Sentry.metrics.distribution(bucket config dropped; Sentry aggregates server-side)
Yabeda tags map directly to attributes:. No pre-registration needed, so the registration hooks are no-ops.
Because Sentry.metrics are trace-connected, if sentry-rails or sentry-sidekiq is tracing the current request or job, metrics emitted via the adapter should automatically carry that trace context, letting you pivot from a metric spike directly into the relevant trace.
👍 if you'd use this