Guest User

Untitled

a guest
Dec 14th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. def call
  2. logger = context.logger || Rails.logger
  3. buckets = get_available_items_in_catalog_by_store
  4.  
  5. logger.debug('catalog_stats_reporter') { "There were #{buckets.count} stores with items in the catalog" }
  6.  
  7. gauges = buckets.map do |bucket|
  8. [ 'items_in_elasticsearch', bucket['doc_count'], { store_id: bucket['key'] }]
  9. end
  10.  
  11. # Send store total gauges
  12. gauges.each_slice(100) do |slice|
  13. sleep(1) # This is to avoid throttling on SignalFX's side
  14. sfx_client.set_gauges(slice, synchronous: true)
  15. end
  16.  
  17. # Send orphaned items in ES gauge
  18. orphaned_items = [ 'orphaned_items_in_elasticsearch', get_orphaned_items_total]
  19. sfx_client.set_gauges(orphaned_items, synchronous: true)
  20. end
Add Comment
Please, Sign In to add comment