It`s worth understanding how Sentry`s grouping mechanism works. In the fingerprint rules, we will see how to define rules for new incoming outputs of our choice, by which they can be grouped. This will have no impact on historical issues. You can customize error grouping by using a combination of the following options, listed from least complex to most complex: Sentry applies some general principles to grouping together the correct event types. However, there are limitations to the current system, where Sentry must find “the single group” because an event can only reach one at a time. To understand how Sentry understands groups, it`s important to understand that to find the right group, you need to realize that the problem is fundamentally subjective and actually depends on the source of the error. By default, Sentry runs one of our built-in grouping algorithms to generate an event fingerprint based on the information available in the event. Available information and grouping algorithms vary depending on the type of event. Sentinel fingerprints display error events based on information such as stacktrace, exception, and message. Transaction events are considered based on their scope. The exact algorithm has changed over time and Sentry continues to use the algorithm that was active when you created the project.
You can update the grouping policy in the general project settings. If no stack trace is available, the system must use another grouping method. Fallback is what we call “message-based grouping,” and it`s a fairly limited method. We take the first line of the message and apply a cleaning logic. For example, if numbers are found, they are replaced with a static placeholder. The same goes for known timestamps, UUIDs, and other similar things. In many cases, however, it is impossible to clean the source of these chains, so fallback grouping is very likely to produce a large number of independent groups. The consequences of forming too many groups today are spam warning and the inability to work with multiple problems at once. When Sentry stops alerting all new groups and has tools to work on multiple groups, opportunities arise. In particular, the grouping algorithm could continue to take only the fingerprint of the stack track, but a secondary process could occur peretically and clean the associated fingerprints in a larger group.
If we take this example get_current_user, creating 50 independent groups is not a big problem if no alerts are triggered. If, after 5 minutes, the system finds that they are indeed all very related (for example, the error is “in get_current_user”), it could leave the generated 50 groups alone, but create a new group that connects the other 50 groups, hide/defuse the 50 individual groups in the UI, and let the user work with the larger group instead. The main way to group Sentry is stack trace. Equivalent stack traces (with a corresponding error type) indicate the same error. However, there is a basic variance in stack tracks to create a fingerprint of the stack track, which presents some challenges. When you create a Sentry project, the latest version of the error grouping algorithm is automatically selected. This ensures that grouping behavior is consistent across a project. To upgrade an existing project to a new version of the error grouping algorithm, go to Settings > Projects > [Project] > Problem Grouping > Upgrade Grouping. After upgrading to a new error grouping algorithm, new groups will likely be created. You can view a fingerprint by opening an issue, clicking the JSON link, and searching for the fingerprint property in that file. If the default grouping was used, “default” is written to it. If a different group was used, you will see the actual value of the fingerprint for yourself.
Stack tracking rules can be used as a combination of SDK and project settings. That`s why we keep the documentation in one place. All projects created after June 25, 2017 automatically prioritize fingerprints and titles created in custom grouping rules. For example, if you explicitly send a fingerprint and title in an event`s payload and have custom grouping rules, the custom grouping rules override the fingerprint and title sent in the payload. For projects created before this date, if you explicitly send fingerprints and have custom grouping rules, the fingerprints and titles sent in an event`s payload take precedence. Older projects can be modified to prioritize custom fingerprint rules by enabling custom instance fingerprint and title replacement migration in a project settings. Whenever the default error grouping behavior changes, Sentry releases it as a new version. Therefore, changes to the default behavior do not affect the grouping of existing issues. to replace automatic grouping. Now, all exceptions are grouped together with the same fingerprint, regardless of their traces. When an event is included in Relay, Relay already associates the event with the current version of the collection configuration.
This means that from the first moment an event enters the infrastructure, the decision has been made as to which version of the aggregation algorithm has been decided. In Python, for example, each image contributes to the module name, function name, and context line (this is the source code of the line the frame pointer was pointing to, removing the leading and trailing spaces). The motivation here is this: modules and functions are relatively rough indicators and a function can often fail from different branches, so taking into account the source code is also less likely to overgroup. However, this also means that refactoring on a line that changes the source code rather than the functionality can result in the unnecessary creation of a new line. The other consequence of this is that the source code must be available for bundling. This works well in Python because the Python SDK usually submits the source code, but for example, we cannot use the same rule in C++ if the availability of the source code is not guaranteed and one version with the source code may enter while another may not be. We also have the hierarchical grouping prototype that tries to group on fewer entries. This system has some limitations, but many groups are less likely to be created. Unfortunately, the user experience is not specified, as working with parts of the group is not an option. Since we can only create one group based on fingerprint, we strive to eliminate unnecessary noise between the stacks.
This is achieved largely by removing entire images from the stack for grouping. There are two ways to remove frames: either they are removed from the collection altogether, or they are marked as “out of application”, which means that they contain code that has nothing to do with the application created by the developer. This means, for example, that if you use the Django framework, we mark framework frameworks as having no application code, making them “ignored” for bundling. What is a fingerprint? A fingerprint is a way to uniquely identify an event. By default, Sentry sets a fingerprint for you. Sentry uses its own built-in grouping algorithms to generate a fingerprint based on the information available in the event, such as a stack trace, exception, and message. Events with the same fingerprint are grouped together.