sentry-relay 0.8.58__zip → 0.8.59__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sentry-relay
3
- Version: 0.8.58
3
+ Version: 0.8.59
4
4
  Summary: A python library to access sentry relay functionality.
5
5
  Author: Sentry
6
6
  Author-email: hello@sentry.io
@@ -31,6 +31,7 @@ __all__ = [
31
31
  "validate_sampling_condition",
32
32
  "validate_sampling_configuration",
33
33
  "validate_project_config",
34
+ "normalize_cardinality_limit_config",
34
35
  "normalize_global_config",
35
36
  ]
36
37
 
@@ -309,6 +310,34 @@ def validate_project_config(config, strict: bool):
309
310
  raise ValueError(error)
310
311
 
311
312
 
313
+ def normalize_cardinality_limit_config(
314
+ config,
315
+ json_dumps: Callable[[Any], Any] = json.dumps,
316
+ json_loads: Callable[[str | bytes], Any] = json.loads,
317
+ ):
318
+ """Normalize the cardinality limit config.
319
+
320
+ Normalization consists of deserializing and serializing back the given
321
+ cardinality limit config. If deserializing fails, throw an exception. Note that even if
322
+ the roundtrip doesn't produce errors, the given config may differ from
323
+ normalized one.
324
+
325
+ :param config: the cardinality limit config to validate.
326
+ :param json_dumps: a function that stringifies python objects
327
+ :param json_loads: a function that parses and converts JSON strings
328
+ """
329
+ serialized = json_dumps(config)
330
+ normalized = rustcall(
331
+ lib.normalize_cardinality_limit_config, encode_str(serialized)
332
+ )
333
+ rv = decode_str(normalized, free=True)
334
+ try:
335
+ return json_loads(rv)
336
+ except Exception:
337
+ # Catch all errors since json.loads implementation can change.
338
+ raise ValueError(rv)
339
+
340
+
312
341
  def normalize_global_config(
313
342
  config,
314
343
  json_dumps: Callable[[Any], Any] = json.dumps,
@@ -0,0 +1 @@
1
+ 0.8.59
@@ -1 +0,0 @@
1
- 0.8.58
File without changes
File without changes