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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add TimberTag #1974

Merged
merged 1 commit into from Apr 6, 2022
Merged

Fix: Add TimberTag #1974

merged 1 commit into from Apr 6, 2022

Conversation

audkar
Copy link
Contributor

@audkar audkar commented Apr 5, 2022

馃摐 Description

Brings back TimberTag. Closes #1900

馃挕 Motivation and Context

We are relying heavily on TimberTag value. One of our dependencies is abusing Timber logging. We were using this tag to filter out these events. This is a blocker to upgrade Sentry for us.

I decided not to use reflection, since retrieving value is not enough. We would also have to write tag clearing logic via reflection.

Pros:

  • This approach will not break if internal Timber's tag management logic change in the future.
  • No need to write tag clearing logic

Cons:

  • Timber will format message string, which we don't use (performance)

馃挌 How did you test it?

Unit test

馃摑 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

馃敭 Next steps

@romtsn
Copy link
Member

romtsn commented Apr 5, 2022

Thanks for the PR!

Cons:

  • Timber will format message string, which we don't use (performance)

Unfortunately, that's why we've made that PR in the first place and gone away from the log method of timber. This was resulting in bad user experience, since Timber is adding the stacktrace to the message and this was duplicated on Sentry (since Sentry parses and displays the stacktrace nicely already). 馃憞

image

So, I'm unsure if we can accept this solution, @marandaneto thoughts?

@audkar
Copy link
Contributor Author

audkar commented Apr 5, 2022

Unfortunately, that's why we've made that PR in the first place and gone away from the log method of timber.

I think you misunderstood me. That message is not going to be sent with Sentry event. (as verification all previous tests are passing)

Previously you ware using message from this Timber method. After change you made this no-op. This PR doesn't change this behavior.

 override fun log(
        priority: Int,
        tag: String?,
        message: String,
        t: Throwable?
    ) {
        // no-op as we've overridden all the methods
    }

鈽濓笍 this message contains merged "message+stacktrace".

Only downside of this PR is that Timber still creates this variable. But it is not logged in Sentry events.

Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, indeed, I overlooked 馃う LGTM, that's a clever solution.

@audkar
Copy link
Contributor Author

audkar commented Apr 5, 2022

"Changelog" CI Action is failing. Do I need to to something?

@romtsn
Copy link
Member

romtsn commented Apr 5, 2022

Could you also add a changelog entry?

@romtsn
Copy link
Member

romtsn commented Apr 5, 2022

"Changelog" CI Action is failing. Do I need to to something?

Yeah, add a changelog entry mentioning PR id, something like:

* Fix: bring back support for `Timber.tag` (#1974)

@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #1974 (c9f5f35) into main (b8b2aa4) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #1974   +/-   ##
=========================================
  Coverage     75.60%   75.60%           
  Complexity     2270     2270           
=========================================
  Files           225      225           
  Lines          8072     8072           
  Branches        852      852           
=========================================
  Hits           6103     6103           
  Misses         1558     1558           
  Partials        411      411           

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update b8b2aa4...c9f5f35. Read the comment docs.

@marandaneto
Copy link
Contributor

@romtsn We'd need to update docs, sine we mention the removal of this feature.
@audkar thanks for doing this.

@romtsn
Copy link
Member

romtsn commented Apr 6, 2022

@marandaneto yeah, had that in mind, will open up a PR. I think a new patch release would worth it here, wdyt?

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

Successfully merging this pull request may close these issues.

Support Timber tags
4 participants