Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i cannot stop this message: "WARN -- datadog: [datadog] In all known versions of Ruby 3.x]... #4231

Closed
modosc opened this issue Dec 16, 2024 · 4 comments · Fixed by #4232
Closed
Assignees
Labels
bug Involves a bug community Was opened by a community member profiling Involves Datadog profiling

Comments

@modosc
Copy link

modosc commented Dec 16, 2024

Current behaviour
we have a rails app running in ecs. we run in docker container with the dd sidecar.

since we enabled allocation profiling this message has been printing to STDOUT multiple times any time we run any sort of rails command:

# bin/rails console
W, [2024-12-16T21:18:33.543770 #1526]  WARN -- datadog: [datadog] In all known versions of Ruby 3.x, using Ractors may result in allocation profiling unexpectedly stopping (https://bugs.ruby-lang.org/issues/19112). Note that this stop has no impact in your application stability or performance. This does not happen if Ractors are not used.
W, [2024-12-16T21:18:33.923679 #1526]  WARN -- datadog: [datadog] In all known versions of Ruby 3.x, using Ractors may result in allocation profiling unexpectedly stopping (https://bugs.ruby-lang.org/issues/19112). Note that this stop has no impact in your application stability or performance. This does not happen if Ractors are not used.
W, [2024-12-16T21:18:33.975804 #1526]  WARN -- datadog: [datadog] In all known versions of Ruby 3.x, using Ractors may result in allocation profiling unexpectedly stopping (https://bugs.ruby-lang.org/issues/19112). Note that this stop has no impact in your application stability or performance. This does not happen if Ractors are not used.
Loading sandbox environment (Rails 8.0.1)
rails-app(sandbox)>

the logging comes from

elsif RUBY_VERSION.start_with?("3.")

note that the above log messages are not going to the datadog or rails logger because they're not properly formatted (all of our logs are json formatted, including the datadog logs).

we've tried setting:

  • DD_TRACE_STARTUP_LOGS=false in the datadog agent container and our application container
  • DD_LOG_LEVEL=error in the datadog agent container and our application container
  • c.logger.level = Logger::ERROR in the initializer

but nothing changes.

this is breaking some of our automation. short of disabling this functionality (which is what we're going to do now) is there anything we can do to quiet this?

Expected behaviour
there should be a way to disable these

Steps to reproduce

Environment

  • datadog version: datadog (2.8.0)
  • Configuration block (Datadog.configure ...):
  # see https://github.com/DataDog/dd-trace-rb/issues/2012
  Datadog.configuration.tracing.log_injection = false

  Datadog.configure do |c|
    c.tracing.enabled = true
    # c.profiling.enabled = true

    c.tracing.instrument :action_mailer
    c.tracing.instrument :action_cable
    c.tracing.instrument :rails
    c.tracing.instrument :faraday, split_by_domain: true

    c.logger.level = Logger::ERROR
  end
DD_PROFILING_ALLOCATION_ENABLED=true
DD_GIT_REPOSITORY_URL=a-git-repo-url
DD_PROFILING_PREVIEW_GVL_ENABLED=true
DD_PROFILING_ENABLED=true
DD_LOG_LEVEL=ERROR
DD_ENV=sandbox
DD_VERSION=a-git-sha
DD_GIT_COMMIT_SHA=a-git-sha
DD_TRACE_STARTUP_LOGS=false
  • Ruby version:
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin24]
  • Operating system:
Linux ip-10-0-87-157.ec2.internal 5.10.228-219.884.amzn2.x86_64 #1 SMP Wed Oct 23 17:17:00 UTC 2024 x86_64 GNU/Linux
  • Relevant library versions:
@modosc modosc added bug Involves a bug community Was opened by a community member labels Dec 16, 2024
@modosc
Copy link
Author

modosc commented Dec 16, 2024

this is similar to #3940 except the solution there doesn't seem to work here (it does disable the configuration printing though which is nice).

@ivoanjo ivoanjo self-assigned this Dec 17, 2024
@ivoanjo ivoanjo added the profiling Involves Datadog profiling label Dec 17, 2024
@ivoanjo
Copy link
Member

ivoanjo commented Dec 17, 2024

Hey @modosc, thanks for reaching out!

You're absolutely right. We missed it, but due to a few shortcomings with how the gem is set up, it's really really hard to eliminate this message right now.

I'll have a PR out soon to improve this, but until it gets released, here's two suggestions:

  1. Enable profiling via code only, and change configuration in two steps:

    • Remove DD_PROFILING_ENABLED env var
    • Change config block to:
  Datadog.configure { |c| c.logger.level = Logger::ERROR }

  Datadog.configure do |c|
    c.tracing.enabled = true
    c.profiling.enabled = true

    c.tracing.instrument :action_mailer
    c.tracing.instrument :action_cable
    c.tracing.instrument :rails
    c.tracing.instrument :faraday, split_by_domain: true
  end

This fixes the issue, although it's definitely awkward ;)

(In more detail, the issue is that a) when Datadog.configure runs, new logger/log level only gets picked after that warning gets emitted; thus this workaround solves that; and b) when starting profiling using DD_PROFILING_ENABLED, the profiler will load before the Datadog.configure block runs, and thus it will emit the warning before the config gets updated)

  1. Pass DD_PROFILING_ENABLED=false when running scripts and rails console.

It wasn't clear from the report if you wanted to also have profiling in these situations, so it's always an option to disable it selectively, if you don't plan on looking at profiles for them.

@ivoanjo
Copy link
Member

ivoanjo commented Dec 17, 2024

Reopening ticket until we get feedback on the fix :)

@ivoanjo ivoanjo reopened this Dec 17, 2024
@modosc
Copy link
Author

modosc commented Dec 18, 2024

thanks @ivoanjo the solution from #4231 (comment) solved our issues.

@modosc modosc closed this as completed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug community Was opened by a community member profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants