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

Initializing using console-output-datadog results in uninitialized constant Console::Output::Datadog (NameError) #3

Closed
Goos opened this issue Aug 18, 2023 · 5 comments

Comments

@Goos
Copy link

Goos commented Aug 18, 2023

When attempting to use Console with CONSOLE_OUTPUT set to Console::Output::Datadog,Console::Output::Default, I get the following error:

.../ruby/gems/console-1.23.2/lib/console/output.rb:19:in `block in new': uninitialized constant Console::Output::Datadog (NameError)

					Output.const_get(name).new(output, **options)
					      ^^^^^^^^^^
	from .../ruby/gems/console-1.23.2/lib/console/output.rb:18:in `each'
	from .../ruby/gems/console-1.23.2/lib/console/output.rb:18:in `inject'
	from .../ruby/gems/console-1.23.2/lib/console/output.rb:18:in `new'
	from .../ruby/gems/console-1.23.2/lib/console/logger.rb:51:in `default_logger'
	from .../ruby/gems/console-1.23.2/lib/console/logger.rb:60:in `local'
	from .../ruby/gems/fiber-local-1.0.0/lib/fiber/local.rb:45:in `instance'
	from .../ruby/gems/console-1.23.2/lib/console.rb:15:in `logger'
	from .../ruby/gems/falcon-0.42.3/bin/falcon:30:in `rescue in <top (required)>'
	from .../ruby/gems/falcon-0.42.3/bin/falcon:25:in `<top (required)>'
	from .../ruby/bin/falcon:25:in `load'
	from .../ruby/bin/falcon:25:in `<top (required)>'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `load'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:23:in `run'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli.rb:492:in `exec'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli.rb:34:in `dispatch'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/cli.rb:28:in `start'
	from .../ruby/gems/bundler-2.4.10/exe/bundle:45:in `block in <top (required)>'
	from .../ruby/gems/bundler-2.4.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from .../ruby/gems/bundler-2.4.10/exe/bundle:33:in `<top (required)>'
	from .../ruby/bin/bundle:25:in `load'
	from .../ruby/bin/bundle:25:in `<main>'

It is being required correctly, as manual initialization of Console::Output::Datadog works just fine.

I was thinking of initializing it manually, but the problem with that approach is that the fiber-local logger is initialized lazily for each fiber, and when it does, it tries to do so using the environment variables again, since the one I initialize manually during the rails app startup is seemingly assigned to Console.logger on a different thread.

Do you have any recommendation on how to proceed?

@ioquatix
Copy link
Member

Hmm, it looks like a bug, let me investigate.

@Goos
Copy link
Author

Goos commented Aug 23, 2023

Hey @ioquatix! Did you manage to make any sense of this? Happy to help reproduce if not

@ioquatix
Copy link
Member

Sorry, will take a look tomorrow.

@ioquatix
Copy link
Member

ioquatix commented Oct 4, 2023

Hello, sorry for the late follow-up.

I have an example of how to do this here: https://github.com/socketry/falcon-rails-example#logging-to-datadog

@ioquatix
Copy link
Member

ioquatix commented Feb 8, 2024

Let me know if you need further assistance.

@ioquatix ioquatix closed this as completed Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants