-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd6a522
commit 3fa88db
Showing
7 changed files
with
128 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1 @@ | ||
from sentry_relay import _relay_pyo3 | ||
|
||
__all__ = [] | ||
__doc__ = _relay_pyo3.__doc__ | ||
|
||
if hasattr(_relay_pyo3, "__all__"): | ||
__all__ = _relay_pyo3.__all__ | ||
|
||
|
||
def _import_all(): | ||
submodules = ["auth", "consts", "exceptions", "processing"] | ||
glob = globals() | ||
for modname in submodules: | ||
if modname[:1] == "_": | ||
continue | ||
mod = __import__("sentry_relay.%s" % modname, glob, glob, ["__name__"]) | ||
if not hasattr(mod, "__all__"): | ||
continue | ||
__all__.extend(mod.__all__) | ||
for name in mod.__all__: | ||
obj = getattr(mod, name) | ||
if hasattr(obj, "__module__"): | ||
obj.__module__ = "sentry_relay" | ||
glob[name] = obj | ||
|
||
|
||
_import_all() | ||
del _import_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from __future__ import annotations | ||
from ._relay_pyo3 import RustStoreNormalizer, validate_sampling_configuration, compare_versions, validate_pii_selector, validate_pii_config, validate_rule_condition, validate_sampling_condition, is_codeowners_path_match, split_chunks, _pii_strip_event, parse_release, normalize_global_config, _pii_selector_suggestions_from_event, convert_datascrubbing_config, is_glob_match, meta_with_chunks, normalize_cardinality_limit_config, normalize_project_config, VALID_PLATFORMS, GeoIpLookup | ||
|
||
import json | ||
from typing import Callable, Any | ||
|
||
__all__ = [ | ||
"split_chunks", | ||
"meta_with_chunks", | ||
"StoreNormalizer", | ||
"GeoIpLookup", | ||
"is_glob_match", | ||
"is_codeowners_path_match", | ||
"parse_release", | ||
"validate_pii_selector", | ||
"validate_pii_config", | ||
"convert_datascrubbing_config", | ||
"pii_strip_event", | ||
"pii_selector_suggestions_from_event", | ||
"VALID_PLATFORMS", | ||
"validate_rule_condition", | ||
"validate_sampling_condition", | ||
"validate_sampling_configuration", | ||
"normalize_project_config", | ||
"normalize_cardinality_limit_config", | ||
"normalize_global_config", | ||
] | ||
|
||
class StoreNormalizer: | ||
def __init__( | ||
self, **config | ||
): | ||
self.inner = RustStoreNormalizer(**config) | ||
|
||
def normalize_event( | ||
self, | ||
event=None, | ||
raw_event=None, | ||
): | ||
if raw_event is None: | ||
raw_event = json.dumps(event, ensure_ascii=False) | ||
if isinstance(raw_event, str): | ||
raw_event = raw_event.encode(errors="replace") | ||
|
||
rv = self.inner.normalize_event(raw_event) | ||
return json.loads(rv) | ||
|
||
def pii_strip_event( | ||
config, | ||
event, | ||
): | ||
event = json.dumps(event) | ||
rv = _pii_strip_event(config, event) | ||
return json.loads(rv) | ||
|
||
def pii_selector_suggestions_from_event(event): | ||
event = json.dumps(event) | ||
rv = _pii_selector_suggestions_from_event(event) | ||
return json.loads(rv) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.