honeycombio / libhoney-rb

Ruby library for sending data to Honeycomb
Apache License 2.0
11 stars 30 forks source link

Send events to the batch endpoint instead of the single event endpoint #42

Closed martin308 closed 5 years ago

martin308 commented 5 years ago

Changes the endpoint that we send events to the batch endpoint.

The previous flow of events was like this:

we now have the following flow:

Benchmarking

Using the following code, to send 1000 events using both the current version of libhoney and this new method

require "benchmark"
require "libhoney"

libhoney = Libhoney::Client.new(writekey: "...", dataset: "libhoney-benchmark")

b = Benchmark.measure do
  1000.times do
    event = libhoney.event
    event.add_field("look", "here")
    event.send
  end

  libhoney.close(true)
end

puts b

Current version:

user system total real
2.020500 0.119861 2.140361 ( 7.310318)
1.965627 0.117135 2.082762 ( 7.354831)
2.012084 0.123885 2.135969 ( 7.436962)

New version:

user system total real
0.107759 0.041983 0.149742 ( 0.493777)
0.091437 0.039685 0.131122 ( 0.530462)
0.111085 0.037703 0.148788 ( 0.482274)
christineyen commented 5 years ago

removing myself as a reviewer but leaving EXTREMELY POSITIVE FEELINGS in the air ✨