Skip to content

Rollup hash does not consider custom Exception data #161

@AmyJeanes

Description

@AmyJeanes

Not sure if this is intentional or not but currently the GetHash function only includes the Exception.ToString() and optionally MachineName but it does not consider custom Exception metadata - for example (from opserver):

image

Source for the GetHash function:

/// <summary>
/// Gets a unique-enough hash of this error. Stored as a quick comparison mechanism to roll-up duplicate errors.
/// </summary>
/// <param name="includeMachine">Whether to include <see cref="MachineName"/> in the has calculation, creating per-machine roll-ups.</param>
/// <returns>A "Unique" hash for this error.</returns>
public int? GetHash(bool includeMachine)
{
if (!Detail.HasValue()) return null;
var result = Detail.GetHashCode();
if (includeMachine && MachineName.HasValue())
result = (result * 397) ^ MachineName.GetHashCode();
return result;
}

We find this information helpful to recover from what happened here but what seems to happen is that multiple errors with different information get rolled up into one and only one of the exception's message remains and the others are lost

That's cool if this was intended but thought I'd check, may be worth at least having an option for it like the MachineName

Happy to do a PR to implement this if you agree that it always should / should have an option to 😄

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions