Sessions with replays | @session.has_replay:true | Keep sessions with a replay to ensure the system does not discard any sessions with session replays available. |
Sessions with errors | @type:error | A default filter that can be applied to retain all sessions that contain at least 1 error. |
Sessions with mobile crashes | @type:error @error.is_crash:true | A filter that can be applied to retain all sessions that ended with a crash. |
Sessions | @type:session | A default filter, placed last in the list, to apply to all sessions, which allows you to retain or discard a percentage of them. |
App versions | @type:session version:v1.1.0-beta | Filtering by app version (beta, alpha, or specific version) ensures all sessions from a particular build are saved for detailed analysis and troubleshooting. |
Environments | @type:session environment:stage | When collecting sessions from various build types or environments, ensure you capture at least 100% of sessions from staging environments, while collecting a smaller percentage from dev/test environments. |
Feature flags | @type:session feature_flags.checkout_type:treatment_v1 | If you are already using feature flags, you can choose to keep 100% of sessions with specific feature flag treatments. |
Custom attributes | @type:session @context.cartValue:>=500 | Create filters using almost any query, including session custom attributes, to specify retention criteria. For example, in the Datadog demo app Shopist, the cart value is a custom session attribute. This allows retention of sessions with high cart values, facilitating quick troubleshooting of revenue-impacting issues. |
Session with user attributes | @type:session user.tier:paid | Use user information from a session to create a filter. For example, you can retain sessions for all your paid tier users. |
Sessions with a specific user | @type:session user.id:XXXXX | This filter can target sessions from specific users, such as a production test account or an executive who regularly tests the application. |
Sessions with a specific action | @type:action @action.name:XXXXX | You can retain all sessions with a specific action that the SDK automatically tracks out-of-the-box or a custom action that you instrumented in your code. |
Sessions with a specific duration | @session.view_count > 3 OR @session.duration > 15, retention rate 100% | If you notice many short sessions, like a user viewing a page for 10 seconds without further action or errors, they are typically not useful. You can use a duration retention filter to reduce these sessions. |
Sessions with a network error 4XX and 5XX | @type:resource @resource.status_code:>=400 | Frontend applications often encounter issues with downstream services returning 4XX or 5XX status codes. Using this filter, you can capture all sessions with resource calls that result in error codes. |