Replies: 1 comment 3 replies
-
Hi @hjohn
The stack hash implementation was a contribution from the community in #228 . Perhaps the original author, @pismy, could explain the reasoning. Your idea sounds pretty good to me. Although, I think at a minimum it should hash the first stack frame of each Throwable in the cause chain.
This seems reasonable to me. Would you be willing/able to submit a PR? |
Beta Was this translation helpful? Give feedback.
-
I am wondering, why does the StackHasher go through all stack trace elements (filtering out some according to the exclude patterns) to compute its hash? This seems rather expensive for little added benefit.
The reason I ask is that it seems to me that the very last stack trace element (the one where the exception is thrown) will be unique already as you can only throw a single exception from a single location and it should bubble up in the same way, so the rest of the elements will be similar, barring some proxy/cglib generated elements.
In fact, I've used this method of hashing before in large projects (hashing only the element that threw the exception), and the hash was certainly highly useful in grouping the same exceptions together without hashing a complete trace. This also means you donot need to use AND correctly configure a filtering mechanism for unstable stack trace elements.
I suppose that "engineered" exceptions or exceptions without a stacktrace could be miss hashed, but that seems to be such a rare situation that I donot think it warrants having a full hash as the default behavior.
Maybe this simplified mechanism could be provided as an option for those unwilling to do exhaustive analysis on what exactly to include from traces to get stable hashes?
Beta Was this translation helpful? Give feedback.
All reactions