Skip to content

Commit 26027a1

Browse files
authored
add pipeline id to thread context during init/start (#17944)
1 parent 50fc645 commit 26027a1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

logstash-core/lib/logstash/java_pipeline.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ module LogStash; class JavaPipeline < AbstractPipeline
4545
def initialize(pipeline_config, namespaced_metric = nil, agent = nil)
4646
@logger = self.logger
4747
super pipeline_config, namespaced_metric, @logger, agent
48+
49+
Util::with_logging_thread_context('pipeline.id' => pipeline_id) do
50+
finish_initialization
51+
end
52+
end
53+
54+
def finish_initialization
4855
open_queue
4956

5057
@worker_threads = []
@@ -126,9 +133,11 @@ def filters?
126133
def start
127134
# Since we start lets assume that the metric namespace is cleared
128135
# this is useful in the context of pipeline reloading
129-
collect_stats
130-
collect_dlq_stats
131-
initialize_flow_metrics
136+
Util::with_logging_thread_context("pipeline.id" => pipeline_id) do
137+
collect_stats
138+
collect_dlq_stats
139+
initialize_flow_metrics
140+
end
132141

133142
@logger.debug("Starting pipeline", default_logging_keys)
134143

0 commit comments

Comments
 (0)