-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat: Ruby Logger instrumentation #983
base: main
Are you sure you want to change the base?
feat: Ruby Logger instrumentation #983
Conversation
…-ruby-contrib into logger-instrumentation
…elle/opentelemetry-ruby-contrib into logger-instrumentation
Appraisal can't install gems from a git source. Since the appraisal is only necessary for active_support_logger, disable those tests while working on other features.
chore: Allow logger patch tests to run
…-ruby-contrib into logger-instrumentation
…elle/opentelemetry-ruby-contrib into logger-instrumentation
feat: map logger level to OTel level
…ntelemetry-ruby-contrib into logger-instrumentation
Rails 7.1+ uses ActiveSupport::BroadcastLogger. This needs to protect against emitting duplicate logs in a different way than ActiveSupport::Logger.broadcast. Emits the log record for the first logger in the broadcast, skip the others. Reset everything at the end of the method call.
* Add references to released logs gems * Test Rails 7.0 - 8.0 * Rubocop * Set gem version
…ntelemetry-ruby-contrib into logger-instrumentation
severity_text: severity, | ||
severity_number: severity_number(severity), | ||
timestamp: datetime, | ||
body: msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New Relic uses formatted_message
here. This includes both the progname and the message in the body, whereas msg
does not include the progname. Which seems more appropriate?
Test the outcome rather than the presence of variables
I'm still trying to figure out why one of the tests is failing on the CI, but passes locally. However, everything except the ActiveSupportLogger code should be ready for review. Please take a look and I'll push the update as soon as I can! |
Description
This an OpenTelemetry logs bridge for Ruby's standard Logger library.
It also includes patches to
ActiveSupport::Logger.broadcast
and theActiveSupport::BroadcastLogger
to emit only one log record for a broadcast.@khushijain21 is a co-author of this PR and contributed functionality as part of her LFX mentorship with OpenTelemetry in 2024.
TODOs:
Verify OpenTelemetry logs aren't emitted as LogRecords (or should they be?)Seems they canDepending on when this is released, add support for Rails 8 structured logging(structured logging pushed to Rails 8.1)Closes #668