Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sentry_sdk/_types.py
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here were added in from #6178 so they could be used right away

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

SENSITIVE_DATA_SUBSTITUTE = "[Filtered]"
BLOB_DATA_SUBSTITUTE = "[Blob substitute]"
OVER_SIZE_LIMIT_SUBSTITUTE = (
"[Value removed due to size of field exceeding configured maximum size.]"
)


class AnnotatedValue:
Expand Down Expand Up @@ -77,6 +80,26 @@ def removed_because_over_size_limit(cls, value: "Any" = "") -> "AnnotatedValue":
},
)

@classmethod
def substituted_because_over_size_limit(
cls, value: "Any" = OVER_SIZE_LIMIT_SUBSTITUTE
) -> "AnnotatedValue":
"""
The actual value was replaced because the size of the field exceeded the configured maximum size,
for example specified with the max_request_body_size sdk option.
"""
return AnnotatedValue(
value=value,
metadata={
"rem": [ # Remark
[
"!config", # Because of configured maximum size
"s", # The fields original value was substituted
]
]
},
)

@classmethod
def substituted_because_contains_sensitive_data(cls) -> "AnnotatedValue":
"""The actual value was removed because it contained sensitive information."""
Expand Down
Loading
Loading