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

Warning printed when using rails_semantic_logger's hash-based log_tags #3016

Closed
lucthev opened this issue Jul 31, 2023 · 2 comments · Fixed by #3022
Closed

Warning printed when using rails_semantic_logger's hash-based log_tags #3016

lucthev opened this issue Jul 31, 2023 · 2 comments · Fixed by #3022
Assignees
Labels
bug Involves a bug community Was opened by a community member
Milestone

Comments

@lucthev
Copy link

lucthev commented Jul 31, 2023

After upgrading to 1.13.0, I'm seeing a (false) warning in an app using rails_semantic_logger and its somewhat unusual hash-based log_tags:

W, [2023-07-31T17:56:28.916763 #71347]  WARN -- ddtrace: [ddtrace] Unable to add Datadog Trace context to ActiveSupport::TaggedLogging: NoMethodError undefined method `<<' for {:ip=>:remote_ip}:Hash

Coming from this code, which understandably fails when log_tags is a hash:

app.config.log_tags << proc { Tracing.log_correlation if Datadog.configuration.tracing.log_injection }

This method of log tag injection appears to be unnecessary when using rails_semantic_logger, as Datadog injects trace tags via other means, at the individual log level — despite the warning, logs produced by rails_semantic_logger have the correct dd trace tags.

Current behaviour

The above warning.

Expected behaviour

No warning.

Steps to reproduce

I've created a sample app to demonstrate the issue. The relevant bits are lucthev/ddtrace-log-warning-repro@5cf860b...main.

Simply run rails s and a warning should be printed.

@lucthev lucthev added bug Involves a bug community Was opened by a community member labels Jul 31, 2023
@marcotc
Copy link
Member

marcotc commented Aug 1, 2023

Thank you for the quick upgrade, and the detailed issue report, @lucthev!

Seems like a combination of configurations that can be common.

despite the warning, logs produced by rails_semantic_logger have the correct dd trace tags.

This is reassuring, we'll work on a fix shortly!

@TonyCTHsu TonyCTHsu added this to the 1.13.1 milestone Aug 2, 2023
@TonyCTHsu TonyCTHsu linked a pull request Aug 2, 2023 that will close this issue
@marcotc
Copy link
Member

marcotc commented Aug 4, 2023

Fix is done, will be released in the next version of ddtrace: #3022

We'll update this issue when the release is out.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants