LogStash configuration is compiled for every sample
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with lib/logstash/pipeline.rb at the linked line and logstash/devutils/rspec/logstash_helpers.rb at the linked helper method. Trace how config and sample interact, then check the existing RSpec helper tests. Done means repeated samples reuse the compiled configuration by default while a subsequent config can select a different one without breaking current behavior.
Written by the indexing model from the issue text.
Description
We have a quite complex configuration file (approximately 1500 lines) and I believe that this line is costly: https://github.com/elastic/logstash/blob/master/lib/logstash/pipeline.rb#L26
If I understand correctly this code, a new pipeline is created for every sample() method, meaning that the configuration is compiled every time.
Meaning that the following test will load and compile 3 times the same configuration:
require "test_utils"
describe "apache common log format" do
extend LogStash::RSpec
config %q{
# Your logstash filter config here
}
sample "apache log in debug" do
insist { subject["level"] } == "DEBUG"
end
sample "apache log in info" do
insist { subject["level"] } == "INFO"
end
sample "apache log with stack trace" do
insist { subject["stacktrace"] } == "oups!"
end
end
Would it be possible to configure this behavior ? We have 300+ samples and running our tests suite is really slow.
Having said that I think that this behavior should be the default. If I do want to use a different configuration I can call config again with the new configuration, no ?
- Dominant language
- Ruby
- Stars
- 17
- Forks
- 27
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elastic/logstash-devutils
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
elastic/logstash-devutils#111 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
elastic/logstash-devutils#100 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
elastic/logstash-devutils#93 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
elastic/logstash-devutils#92 · 2 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
elastic/logstash-devutils#90 ·
All issues in elastic/logstash-devutils
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100