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::MessagePackFactory.engine_factory

What it means

Fluent::MessagePackFactory::Mixin#msgpack_factory is a deprecated convenience method: it warns once per object (@deprecated_log_done) and then returns Fluent::MessagePackFactory.engine_factory. The Mixin exists for pre-1.x plugin compatibility; new code should call the module function directly.

Source

Thrown at lib/fluent/msgpack_factory.rb:27

#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#

require 'msgpack'
require 'fluent/time'

module Fluent
  module MessagePackFactory
    @@engine_factory = nil

    module Mixin
      def msgpack_factory
        unless @deprecated_log_done
          deprecated_log('Deprecated method: this method is going to be deleted. Use Fluent::MessagePackFactory.engine_factory')
        end
        MessagePackFactory.engine_factory
      end

      def msgpack_packer(*args)
        unless @deprecated_log_done
          deprecated_log('Deprecated method: this method is going to be deleted. Use Fluent::MessagePackFactory.msgpack_packer')
        end
        MessagePackFactory.msgpack_packer(*args)
      end

      def msgpack_unpacker(*args)
        unless @deprecated_log_done
          deprecated_log('Deprecated method: this method is going to be deleted. Use Fluent::MessagePackFactory.msgpack_unpacker')
        end
        MessagePackFactory.msgpack_unpacker(*args)
      end

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Replace msgpack_factory with Fluent::MessagePackFactory.engine_factory and drop the Mixin include.
  2. For packers/unpackers specifically, use Fluent::MessagePackFactory.msgpack_packer/msgpack_unpacker.
  3. Audit the plugin for the other deprecated mixin accessors (msgpack_packer, msgpack_unpacker) in the same pass.

Example fix

# before
class MyInput < Fluent::Plugin::Input
  include Fluent::MessagePackFactory::Mixin
  def some_method
    factory = msgpack_factory
  end
end

# after
class MyInput < Fluent::Plugin::Input
  def some_method
    factory = Fluent::MessagePackFactory.engine_factory
  end
end
Defensive patterns

Strategy: validation

Validate before calling

# CI guard: fail on deprecated MessagePackFactory::Mixin accessors
# grep -rn '\bmsgpack_factory\b' lib/ --include='*.rb' | grep -v 'Fluent::MessagePackFactory' && exit 1 || exit 0

Type guard

factory = Fluent::MessagePackFactory.respond_to?(:engine_factory) ? Fluent::MessagePackFactory.engine_factory : fallback_factory

Prevention

When it happens

Trigger: A plugin includes Fluent::MessagePackFactory::Mixin and calls msgpack_factory (typically to build packers/unpackers for custom MessagePack serialization in overriden methods).

Common situations: Plugins written for Fluentd v0.12-style APIs, or code copy-pasted from older plugins, still exercising the mixin accessor.

Related errors


AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21). Data as JSON: /api/errors/06cc052fb764673b. Report an issue: GitHub.