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_packer

What it means

Fluent::MessagePackFactory::Mixin#msgpack_packer is a deprecated shim: it warns once per object via deprecated_log and delegates to Fluent::MessagePackFactory.msgpack_packer(*args). Plugins should obtain packers from the module function directly; the shared engine factory is what both paths use, so behavior is identical.

Source

Thrown at lib/fluent/msgpack_factory.rb:34

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

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

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Replace msgpack_packer(...) with Fluent::MessagePackFactory.msgpack_packer(...).
  2. Remove the now-unneeded include Fluent::MessagePackFactory::Mixin.
  3. Grep the plugin for msgpack_factory/msgpack_unpacker mixin calls and migrate them together.

Example fix

# before
include Fluent::MessagePackFactory::Mixin
packer = msgpack_packer(io)

# after
packer = Fluent::MessagePackFactory.msgpack_packer(io)
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: A plugin that includes Fluent::MessagePackFactory::Mixin calls msgpack_packer (with optional args like an io sink) to serialize records.

Common situations: Legacy plugins or copied code using the mixin's instance helpers for MessagePack packing in multi-process/forwarding code paths.

Related errors


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