Closed liijunwei closed 11 months ago
didn't find related issue / discussion
master
ActiveSupport::Cache::MemoryStore
enabled_breadcrumb_types
MemoryStore
when enabled_breadcrumb_types is empty:
our profiling result shows that Bugsnag.leave_breadcrumb accounts for a big portion of api response time, mainly from: https://github.com/bugsnag/bugsnag-ruby/blob/bdfbf3972f2137b3b9b95194a6bedf9c8edf6555/lib/bugsnag.rb#L282-L287
Bugsnag.leave_breadcrumb
Describe the solution you'd like
when configuration.enabled_breadcrumb_types is empty, this part of initialization/validation is a waste, better get rid of it
configuration.enabled_breadcrumb_types
either one of below works for us
configuration.enabled_breadcrumb_types.empty?
Bugsnag::Breadcrumbs::Breadcrumb.new
breadcrumb
Bugsnag::Rails::DEFAULT_RAILS_BREADCRUMBS
Describe alternatives you've considered
NA
Additional context
We're heavily relying on ActiveSupport::Cache::MemoryStore, and this will give us a significant performance improvement
if the request sounds reasonable to you, I'm glad to prepare a pull request, thank you
profiling example
# 1. run with rails + bugsnag integration # 2. open /tmp/ # 3. drag profiling result to https://www.speedscope.app/ require 'stackprof' require 'active_support' require 'json' def profile(filename, warmup_cycles: 0, &block) warmup_cycles.times { block.call } result = StackProf.run(mode: :wall, aggregate: false, raw: true, &block) path = "/tmp/#{filename}" File.open("/tmp/#{filename}", 'w') { |f| f << JSON.generate(result) } puts "store to file: path :#{path}" end store = ActiveSupport::Cache::MemoryStore.new(compress: false) output_file = "bugsnag-breadcrumbs-#{Time.now.strftime("%m-%d-%Y.%H.%M.%S")}.json" profile(output_file, warmup_cycles: 1) do 1_000.times do store.fetch(:foo, expires_in: rand(10)) { :bar } end end
looks like false analysis after we released our patch to production, closing this for now
didn't find related issue / discussion
Description
Given
master
branch, it's the same logicActiveSupport::Cache::MemoryStore
, which will emit many instrumentation eventsenabled_breadcrumb_types
configuration to empty array as we don't really depend on itMemoryStore
Expected
when
enabled_breadcrumb_types
is empty:Actual
our profiling result shows that
Bugsnag.leave_breadcrumb
accounts for a big portion of api response time, mainly from: https://github.com/bugsnag/bugsnag-ruby/blob/bdfbf3972f2137b3b9b95194a6bedf9c8edf6555/lib/bugsnag.rb#L282-L287Describe the solution you'd like
when
configuration.enabled_breadcrumb_types
is empty, this part of initialization/validation is a waste, better get rid of iteither one of below works for us
configuration.enabled_breadcrumb_types.empty?
beforeBugsnag::Breadcrumbs::Breadcrumb.new
breadcrumb
at allBugsnag::Rails::DEFAULT_RAILS_BREADCRUMBS
configurableDescribe alternatives you've considered
NA
Additional context
We're heavily relying on
ActiveSupport::Cache::MemoryStore
, and this will give us a significant performance improvementif the request sounds reasonable to you, I'm glad to prepare a pull request, thank you
profiling example