fluent/fluentd · warning
Deprecated method: this method is going to be deleted. Use F
Error message
Deprecated method: this method is going to be deleted. Use Fluent::Plugin.add_plugin_dir
What it means
Fluent::Engine#add_plugin_dir is a deprecated compatibility shim: it logs this warning and then forwards to Fluent::Plugin.add_plugin_dir. It exists only so older plugins/scripts registering plugin directories via the Engine singleton keep working. Unlike other deprecation shims in the codebase it warns on every call.
Source
Thrown at lib/fluent/engine.rb:121
end
end
def configure(conf)
@root_agent.configure(conf)
@fluent_log_event_router = FluentLogEventRouter.build(@root_agent)
if @fluent_log_event_router.emittable?
$log.enable_event(true)
end
unless @suppress_config_dump
$log.info :supervisor, "using configuration file: #{conf.to_s.rstrip}"
end
end
def add_plugin_dir(dir)
$log.warn('Deprecated method: this method is going to be deleted. Use Fluent::Plugin.add_plugin_dir')
Plugin.add_plugin_dir(dir)
end
def emit(tag, time, record)
raise "BUG: use router.emit instead of Engine.emit"
end
def emit_array(tag, array)
raise "BUG: use router.emit_array instead of Engine.emit_array"
end
def emit_stream(tag, es)
raise "BUG: use router.emit_stream instead of Engine.emit_stream"
end
def flush!
@root_agent_mutex.synchronize do
@root_agent.flush!View on GitHub (pinned to dd45c6e18d)
Solutions
- Replace the call with Fluent::Plugin.add_plugin_dir(dir).
- Alternatively set the FLUENT_PLUGIN environment variable or pass -p/--plugin dir on the command line to register plugin directories without code.
- Upgrade third-party gems that call the old API.
Example fix
# before
Fluent::Engine.instance.add_plugin_dir('/opt/fluent-plugins')
# after
Fluent::Plugin.add_plugin_dir('/opt/fluent-plugins') Defensive patterns
Strategy: validation
Validate before calling
# Grep guard for CI: fail if the deprecated Engine API is used # grep -rn 'Engine.*add_plugin_dir\|engine\.add_plugin_dir' lib/ && exit 1 || exit 0
Type guard
if defined?(Fluent::Plugin) && Fluent::Plugin.respond_to?(:add_plugin_dir) Fluent::Plugin.add_plugin_dir(dir) end
Prevention
- Use Fluent::Plugin.add_plugin_dir or the -p/--plugin CLI flag in all new code.
- During upgrades, grep plugins for Fluent::Engine usage — most Engine instance methods are deprecated shims.
When it happens
Trigger: A plugin, initializer, or management script calls Fluent::Engine.instance.add_plugin_dir(dir) (the pre-1.x API) instead of the modern module-level API.
Common situations: Old in-house plugins written for Fluentd v0.x that add custom plugin paths at boot; wrapper tools that call Engine APIs directly during test setup.
Related errors
- Deprecated method: this method is going to be deleted. Use F
- Deprecated method: this method is going to be deleted. Use F
- Deprecated method: this method is going to be deleted. Use F
- unknown_key
- Ruby DSL configuration format is deprecated. Please use orig
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/c080fea4f938c855.
Report an issue: GitHub.