logstash-plugins/logstash-integration-kafka

output fails to raise ConfiguratioException, gets uninitialized const

TheVastyDeep opened this issue · 2 comments

logstash 8.11.4 from yum update, run on command line with bundled JVM.

OS is 4.14.334-252.552.amzn2.x86_64 #1 SMP Tue Jan 2 17:47:37 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

The code tries to raise a ConfigurationError here and here. That fails with

Pipeline error {:pipeline_id=>"main", :exception=>#<NameError: uninitialized constant LogStash::Outputs::Kafka::ConfigurationError
Did you mean? LogStash::ConfigLoadingError>, :backtrace=>["org/jruby/RubyModule.java:4324:in const_missing'", "/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-integration-kafka-11.3.2-java/lib/logstash/outputs/kafka.rb:188:in register'",

It should be raising LogStash::ConfigurationError which it successfully does here if configured with partititioner => "bar".

Reproducible using

input { generator { count => 1 lines => [ '' ] } }
output { stdout { codec => rubydebug { metadata => false } } }
output {
    kafka {
        bootstrap_servers => ["127.1.2.3:9092"]
        topic_id => "foo"
        #partitioner => "bar"
        retries => -1
    }
}

retries cannot be a negative number, you can set it to zero if you don't want to use retry.

"retries cannot be a negative number". Yes, obviously. The point is that it should log an informative error message if there is an error in the configuration. NameError is not informative.