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.msgpack_unpacker

What it means

Fluent::MessagePackFactory::Mixin#msgpack_unpacker is a deprecated shim: it warns once per object and delegates to Fluent::MessagePackFactory.msgpack_unpacker(*args). Both return unpackers built from the shared engine factory, so switching is behavior-neutral.

Source

Thrown at lib/fluent/msgpack_factory.rb:41

    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

      def deprecated_log(str)
        if $log
          $log.warn(str)
          @deprecated_log_done = true
        end
      end
    end

    def self.engine_factory(enable_time_support: false)
      @@engine_factory || factory(enable_time_support: enable_time_support)
    end

    def self.msgpack_packer(*args)
      engine_factory.packer(*args)

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Replace msgpack_unpacker(...) with Fluent::MessagePackFactory.msgpack_unpacker(...).
  2. Remove the Mixin include once no mixin accessors remain.
  3. Migrate sibling calls (msgpack_factory, msgpack_packer) in the same change.

Example fix

# before
include Fluent::MessagePackFactory::Mixin
unpacker = msgpack_unpacker(io)

# after
unpacker = Fluent::MessagePackFactory.msgpack_unpacker(io)
Defensive patterns

Strategy: validation

Validate before calling

# CI guard: fail on mixin-style msgpack_unpacker calls
# grep -rn '[^.:]\bmsgpack_unpacker(' lib/ --include='*.rb' && exit 1 || exit 0

Type guard

Fluent::MessagePackFactory.respond_to?(:msgpack_unpacker) # module-level API present and preferred

Prevention

When it happens

Trigger: A plugin including Fluent::MessagePackFactory::Mixin calls msgpack_unpacker (often with an io or initial feed data argument) while deserializing records from sockets/files.

Common situations: Older input plugins (in_forward-style, custom protocol plugins) using the mixin accessor to parse MessagePack streams.

Related errors


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