diff --git a/lib/rackstash/buffer.rb b/lib/rackstash/buffer.rb index 2d1a506..14f500f 100644 --- a/lib/rackstash/buffer.rb +++ b/lib/rackstash/buffer.rb @@ -252,6 +252,7 @@ module Rackstash # @return [Fields::Tags] the resolved tags which are set on the buffer. # All strings are frozen. def tag(*new_tags, scope: nil) + timestamp tags.merge!(new_tags, scope: scope) end diff --git a/spec/rackstash/buffer_spec.rb b/spec/rackstash/buffer_spec.rb index f2089f0..d64c044 100644 --- a/spec/rackstash/buffer_spec.rb +++ b/spec/rackstash/buffer_spec.rb @@ -429,6 +429,11 @@ describe Rackstash::Buffer do expect(buffer.tags).to contain_exactly('tag') end + it 'sets the timestamp' do + expect(buffer).to receive(:timestamp) + buffer.tag('hello') + end + describe 'when passing procs' do let(:struct) { Struct.new(:value) do