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

feat: 🚧 WIP: Logger instrumentation #983

Draft
wants to merge 58 commits into
base: main
Choose a base branch
from

Conversation

kaylareopelle
Copy link
Contributor

@kaylareopelle kaylareopelle commented May 14, 2024

Description

This is a work-in-progress implementation of an OpenTelemetry logs bridge for Ruby's built-in Logger library.

It also includes patches to ActiveSupport::Logger.broadcast and the ActiveSupport::BroadcastLogger to emit only one log record for a broadcast.

It relies on a WIP Logs SDK and OTLP exporter implementation. If you'd like to test out this experimental code, follow the instructions on this gist, or clone this demo repo.

The SDK and OTLP exporter code is being reviewed in small chunks on the open-telemetry/opentelemetry-ruby repository. Follow the progress on the Logs project board.

Once the SDK/exporter code is merged into the main repo, this PR can be taken out of draft mode.

@khushijain21 is a co-author of this PR and contributed functionality as part of her LFX mentorship with OpenTelemetry in 2024.

TODOs:

  • Improve README
  • Add example
  • Add workaround to prevent duplicate logs in Rails 7.1
  • Verify OpenTelemetry logs aren't emitted as LogRecords (or should they be?) Seems they can
  • Determine whether attributes should be able to be passed to the bridge and add this functionality if they should (I'm leaning toward no because this is a bridge of an existing framework that did not have support for attributes, so it doesn't seem likely that attributes have a place to be reasonably added. We could include additional information as attributes, maybe like progname, but I don't know if that's valuable to users)
  • Verify where this bridge should live (currently under the instrumentation directory, but would a bridges directory be more appropriate? => Python puts logs instrumentation in instrumentation, JS put winston in packages, Go uses bridges, Java keeps it in instrumentation)
  • Depending on when this is released, add support for Rails 8 structured logging

Closes #668

kaylareopelle and others added 30 commits September 19, 2023 08:37
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
Copy link
Contributor

👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot

@github-actions github-actions bot added the stale Marks an issue/PR stale label Jun 21, 2024
@kaylareopelle kaylareopelle added keep Ensures stale-bot keeps this issue/PR open and removed stale Marks an issue/PR stale labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep Ensures stale-bot keeps this issue/PR open
Projects
Status: Pending PR
Development

Successfully merging this pull request may close these issues.

Add instrumentation for Ruby Logger leveraging Log Records
3 participants