Sha256: 91e5e88f47f2ff52afd6786dba7d37b70d35e98358d4fc633cefb2daaf89136d

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

# encoding: utf-8
require "logstash/settings"

module LogStash
  class PipelineSettings < Settings

    # there are settings that the pipeline uses and can be changed per pipeline instance
    SETTINGS_WHITE_LIST = [
      "config.debug",
      "config.reload.automatic",
      "config.reload.interval",
      "config.string",
      "dead_letter_queue.enable",
      "metric.collect",
      "path.config",
      "path.queue",
      "pipeline.batch.delay",
      "pipeline.batch.size",
      "pipeline.id",
      "pipeline.output.workers",
      "pipeline.reloadable",
      "pipeline.system",
      "pipeline.workers",
      "queue.checkpoint.acks",
      "queue.checkpoint.interval",
      "queue.checkpoint.writes",
      "queue.drain",
      "queue.max_bytes",
      "queue.max_events",
      "queue.page_capacity",
      "queue.type",
    ]

    # register a set of settings that is used as the default set of pipelines settings
    def self.from_settings(settings)
      pipeline_settings = self.new
      SETTINGS_WHITE_LIST.each do |setting|
        pipeline_settings.register(settings.get_setting(setting).clone)
      end
      pipeline_settings
    end

    def register(setting)
      unless SETTINGS_WHITE_LIST.include?(setting.name)
        raise ArgumentError.new("Only pipeline related settings can be registed in a PipelineSettings object. Received \"#{setting.name}\". Allowed settings: #{SETTINGS_WHITE_LIST}")
      end
      super(setting)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-core-6.0.0.alpha2-java lib/logstash/pipeline_settings.rb