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

Add ActiveSupport tagged logging support #1344

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Add ActiveSupport tagged logging support #1344

merged 2 commits into from
Dec 13, 2024

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Dec 4, 2024

Don't use thread vars in logger

To temporarily set the attributes in the logger instance, use instance variables instead of Thread variables.

I don't know why Thread variables are used here. I don't think it's needed.

Add ActiveSupport tagged logging support

Our logger did not support Rails ActiveSupport tagged logging yet. This was because our logger didn't listen to the tagged, push_tags and pop_tags methods.

Implement these methods to have the logger that wraps our logger call these methods to set tags.

The format is the same as Rails formats it: [My tag value] I decide not to set these as attributes, because they're only values. They have no key and the value can be anything and change frequently.

@tombruijn tombruijn self-assigned this Dec 4, 2024
To temporarily set the attributes in the logger instance, use
instance variables instead of Thread variables.

I don't know why Thread variables are used here. I don't think it's
needed.
@tombruijn tombruijn marked this pull request as ready for review December 5, 2024 09:26
Our logger did not support Rails ActiveSupport tagged logging yet.
This was because our logger didn't listen to the `tagged`, `push_tags`
and `pop_tags` methods.

Implement these methods to have the logger that wraps our logger call
these methods to set tags.

The format is the same as Rails formats it: `[My tag value]`
I decide not to set these as attributes, because they're only values.
They have no key and the value can be anything and change frequently.
@backlog-helper

This comment has been minimized.

2 similar comments
@backlog-helper

This comment has been minimized.

@backlog-helper
Copy link


This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@tombruijn tombruijn merged commit 5da3aac into main Dec 13, 2024
127 checks passed
@tombruijn tombruijn deleted the tagged-logging branch December 13, 2024 12:17
unflxw added a commit that referenced this pull request Dec 19, 2024
This commit removes tagged logging support from `Appsignal::Logger`,
essentially reverting most of the changes in #1344, #1350, #1351 and

The change to use instance variables instead of thread variables is
maintained, as well as the tests that assert the expected behaviour
when used alongside `ActiveSupport::TaggedLogging`, which pass
notwithstanding the reverted functionality. This makes explicit in
our test suite the way in which tagged logging is supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants