Skip to content

Replace deprecated JSON.fast_generate with JSON.generate - #1552

Merged
smith merged 2 commits into
elastic:mainfrom
pascaltozzi:ptozzi/fix-deprecated-fast_generate
Jul 27, 2026
Merged

Replace deprecated JSON.fast_generate with JSON.generate#1552
smith merged 2 commits into
elastic:mainfrom
pascaltozzi:ptozzi/fix-deprecated-fast_generate

Conversation

@pascaltozzi

@pascaltozzi pascaltozzi commented May 8, 2025

Copy link
Copy Markdown
Contributor

What does this pull request do?

This is a non-functional refactor with no behavioral changes.

As of version 2.11.0 of the json gem, JSON.fast_generate has been deprecated because it provides no measurable performance benefit over JSON.generate.

Why is it important?

It remove deprecation warnings and maintain forward compatibility.

Checklist

  • I have signed the Contributor License Agreement.
  • My code follows the style guidelines of this project (See .rubocop.yml)
  • I have rebased my changes on top of the latest main branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • I have updated CHANGELOG.asciidoc
  • I have updated supported-technologies.asciidoc
  • Added an API method or config option? Document in which version this will be introduced

@cla-checker-service

cla-checker-service Bot commented May 8, 2025

Copy link
Copy Markdown

💚 CLA has been signed

@saiqulhaq-hh

Copy link
Copy Markdown

I just monkey patched my app because this one is not merged yet

if ElasticAPM::VERSION == '4.8.0'
    module ElasticAPM
      module Transport
        class Connection
          def initialize(config)
            @config = config
            @metadata = JSON.generate(
              Serializers::MetadataSerializer.new(config).build(
                Metadata.new(config)
              )
            )
            @url = "#{config.server_url}/intake/v2/events"
            @mutex = Mutex.new
          end
        end
      end
    end
  end

@smith
smith enabled auto-merge (squash) July 27, 2026 22:59
@smith
smith merged commit 72d4ee5 into elastic:main Jul 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants