-
Notifications
You must be signed in to change notification settings - Fork 951
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 a flag to normalize the output (remove machine-specific data) #168
Comments
I like this idea. Do you have code that produces the output you included? If so please include it, possibly as a draft PR just for discussion. I'd like you to list all the different items that should be dealt with, and how they will be dealt with. For example, timestamps are an easy case, because you just omit them. Memory addresses are a little harder, because you need to choose whether you'll switch the |
Is there any part of this that can't be done by post-processing the output? This is literally what's done in some of the tests. |
Post-processing might work, but if you mean that we'll just leave the post-processing to the users, that means that many users are not gonna do it because they won't want to write that post-processing algorithm. |
No but I think it makes more sense as a separate function than a flag. |
Advantage of having a separate function: Avoids adding more complexity to our main algorithm. Disadvantages of having a separate function:
So I still support adding this as a flag-- Assuming that Itamar can give good answers to my question above, and write a good implementation. |
I'll have everything written (answers to your questions and implementation ideas) in 24h |
Everything will be documented as detailed as possible (I'll add detailed info to the docs). Code snippets for discussion: now_string = pycompat.time_isoformat(now, timespec='microseconds') if not self.normalize else '' source_path = source_path if not self.normalize else os.path.basename(source_path) value_repr = utils.normalize_repr(value_repr) Where normalize_repr is: def normalize_repr(item_repr):
parts = item_repr.partition(' at')
if parts[1]:
return parts[0] + '>'
return parts[0] This is a naive implementation for truncating the default In general - I tried to use the most efficient logic I could think of since I don't want to increase |
Agreed.
Agreed.
Agreed.
Hmm, instead, when
I disagree, people who are savvy enough to specify a different
Looks good, don't forget adding tests, I'll wait for your PR. |
Merged in #171 |
We came up with a simple but strong usage – diff between traces.
We use it to find bugs or regressions between git-branches and code sections.
However, we deal with removing all the machine-specific data (time stamps, reprs containing memory addresses, absolute paths, thread data etc.).
I thought about adding a flag called “normalize” that will do it.
for example:
the trace without changes (
normalize=False
):normalized trace (
normalize=True
):The text was updated successfully, but these errors were encountered: