{"record":{"id":"c080fea4f938c855","repo":"fluent/fluentd","slug":"deprecated-method-this-method-is-going-to-be-dele","errorCode":null,"errorMessage":"Deprecated method: this method is going to be deleted. Use Fluent::Plugin.add_plugin_dir","messagePattern":"Deprecated method: this method is going to be deleted\\. Use Fluent::Plugin\\.add_plugin_dir","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/fluent/engine.rb","lineNumber":121,"sourceCode":"      end\n    end\n\n    def configure(conf)\n      @root_agent.configure(conf)\n\n      @fluent_log_event_router = FluentLogEventRouter.build(@root_agent)\n\n      if @fluent_log_event_router.emittable?\n        $log.enable_event(true)\n      end\n\n      unless @suppress_config_dump\n        $log.info :supervisor, \"using configuration file: #{conf.to_s.rstrip}\"\n      end\n    end\n\n    def add_plugin_dir(dir)\n      $log.warn('Deprecated method: this method is going to be deleted. Use Fluent::Plugin.add_plugin_dir')\n      Plugin.add_plugin_dir(dir)\n    end\n\n    def emit(tag, time, record)\n      raise \"BUG: use router.emit instead of Engine.emit\"\n    end\n\n    def emit_array(tag, array)\n      raise \"BUG: use router.emit_array instead of Engine.emit_array\"\n    end\n\n    def emit_stream(tag, es)\n      raise \"BUG: use router.emit_stream instead of Engine.emit_stream\"\n    end\n\n    def flush!\n      @root_agent_mutex.synchronize do\n        @root_agent.flush!","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/engine.rb#L103-L139","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nFluent::Engine.instance.add_plugin_dir('/opt/fluent-plugins')\n\n# after\nFluent::Plugin.add_plugin_dir('/opt/fluent-plugins')","handlingStrategy":"validation","validationCode":"# Grep guard for CI: fail if the deprecated Engine API is used\n# grep -rn 'Engine.*add_plugin_dir\\|engine\\.add_plugin_dir' lib/ && exit 1 || exit 0","typeGuard":"if defined?(Fluent::Plugin) && Fluent::Plugin.respond_to?(:add_plugin_dir)\n  Fluent::Plugin.add_plugin_dir(dir)\nend","tryCatchPattern":null,"preventionTips":["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."],"tags":["deprecation","plugin-api","engine"],"backgroundTag":"deprecated-method-migration","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}