getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
927 stars 486 forks source link

Bulk Distribution Metric #2312

Closed mu4farooqi closed 1 month ago

mu4farooqi commented 2 months ago

I want to capture metrics in a Sidekiq job where I'm doing batch processing. I'm doing something like following:

  time_now = Time.now.utc.to_f
  messages.each do |message|
    Sentry::Metrics.distribution(
      'message_dispatch_latency', time_now - message.created_at.to_f, unit: 'millisecond'
    )
  end

Is there a better way to do this. Because here if we have 10 messages, we'll make 10 network calls right? Do we have any option to send bulk metrics.

sl0thentr0py commented 2 months ago

@mu4farooqi that will not send 10 network calls, we locally collect the metrics in a thread and flush them out every 5 seconds. The aggregation / batching is already handled by the SDK. :)

getsantry[bot] commented 1 month ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀