-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Cleanups for our logging helpers #62171
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
Cleanups for our logging helpers #62171
Conversation
|
This is a recreation of #61669 that was reverted due to a regression. After some investigation, we believe the regression is just due to a lack of updated training data for ngen, and the correct process is just to merge this and let training catch up. |
We (mostly) use these to track time, but rather than just letting them directly take a TimeSpan, we were expecting each of the callers to distill it down to milliseconds and the pass it as an integer. This actually clarifies a current surprise that some of our code calls the data points "ticks" but they're actually logging milliseconds, but that wasn't obvious since there were just ints being passed around everywhere. Even for the cases we were passing around milliseconds, what we were often doing is taking a TimeSpan, grabbing it's TotalMilliseconds and then: - casting it to an int to pass around to our logging functions - casting that to a decimal to pass to the log aggregators - doing decimal division to figure out which bucket it goes in - doing a Math.Floor on that result - casting that result back to an int If we just keep everything internally as an int, the division will already round down and we can avoid all the random extra casting.
Makes it clear this is not a base type of the other ones.
0c1b6d8 to
69c194d
Compare
|
@davidwengier Were you so excited to sign off on #61669 that you want to do it a second time? Here's your chance! |
"Hey, that guy signed off on the PR that caused a bunch of perf regressions. We should get him to look at the new one too!" |
davidwengier
left a comment
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.
Looks the same to me!
While looking at our existing logging code to figure out what I can reuse, I noticed a few bits that could use some cleanup. Changes:
Commit at a time may or may not help; on one hand each change is pretty mechanical, but the same pieces of code may get touched by multiple commits so that might increase the total amount of code to read pretty significantly.