Skip to content

Commit

Permalink
Put pipeline_id into ThreadContext after entering flush_thread
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-notka committed Jan 27, 2021
1 parent 5f9242d commit ca8c2ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/logstash/outputs/google_bigquery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
require 'fileutils'
require 'concurrent'

java_import org.apache.logging.log4j.ThreadContext

#
# === Summary
#
Expand Down Expand Up @@ -275,7 +277,9 @@ def write_to_errors_file(messages, table)
end

def init_batcher_flush_thread
pipeline_id = ThreadContext.get('pipeline.id')
@flush_thread = Thread.new do
ThreadContext.put('pipeline.id', pipeline_id)
until stopping?
Stud.stoppable_sleep(@flush_interval_secs) { stopping? }

Expand Down

0 comments on commit ca8c2ce

Please sign in to comment.