reach_commons 0.18.28__tar.gz → 0.18.30__tar.gz

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.
Files changed (32) hide show
  1. {reach_commons-0.18.28 → reach_commons-0.18.30}/PKG-INFO +1 -1
  2. {reach_commons-0.18.28 → reach_commons-0.18.30}/pyproject.toml +1 -1
  3. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/sqs.py +17 -15
  4. {reach_commons-0.18.28 → reach_commons-0.18.30}/README.md +0 -0
  5. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/__init__.py +0 -0
  6. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/app_logging/__init__.py +0 -0
  7. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/app_logging/http_logger.py +0 -0
  8. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/app_logging/log_deprecated_endpoints.py +0 -0
  9. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/app_logging/logger.py +0 -0
  10. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/app_logging/logging_config.py +0 -0
  11. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/__init__.py +0 -0
  12. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/event_processor.py +0 -0
  13. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/hubspot.py +0 -0
  14. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/outscraper.py +0 -0
  15. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/reach_data_bridge.py +0 -0
  16. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/clients/reach_ops_api.py +0 -0
  17. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/mongo/__init__.py +0 -0
  18. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/mongo/customer_persistence.py +0 -0
  19. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/mongo/customer_persistence_async.py +0 -0
  20. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/mongo/validation/__init__.py +0 -0
  21. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/__init__.py +0 -0
  22. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/commons.py +0 -0
  23. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/dynamo_db.py +0 -0
  24. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/exceptions.py +0 -0
  25. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/firehose.py +0 -0
  26. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/kms.py +0 -0
  27. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_aws/s3.py +0 -0
  28. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/reach_base_model.py +0 -0
  29. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/redis_manager.py +0 -0
  30. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/sms_smart_encoding.py +0 -0
  31. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/utils.py +0 -0
  32. {reach_commons-0.18.28 → reach_commons-0.18.30}/reach_commons/validations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reach_commons
3
- Version: 0.18.28
3
+ Version: 0.18.30
4
4
  Summary: Reach Commons is a versatile utility library designed to streamline and enhance development workflows within the Reach ecosystem.
5
5
  License: MIT
6
6
  Author: Engineering
@@ -1,7 +1,7 @@
1
1
  # isort .; black .; poetry build; poetry publish
2
2
  [tool.poetry]
3
3
  name = "reach_commons"
4
- version = "0.18.28"
4
+ version = "0.18.30"
5
5
  description = "Reach Commons is a versatile utility library designed to streamline and enhance development workflows within the Reach ecosystem."
6
6
  authors = ["Engineering <engineering@getreach.ai>"]
7
7
  license = "MIT"
@@ -164,7 +164,6 @@ class SQSClient(BaseSQSClient):
164
164
  "ApproximateNumberOfMessages", # visible
165
165
  "ApproximateNumberOfMessagesNotVisible", # in-flight
166
166
  "ApproximateNumberOfMessagesDelayed", # delayed
167
- "ApproximateAgeOfOldestMessage",
168
167
  ],
169
168
  )
170
169
 
@@ -173,14 +172,8 @@ class SQSClient(BaseSQSClient):
173
172
  visible = int(attrs.get("ApproximateNumberOfMessages", 0))
174
173
  in_flight = int(attrs.get("ApproximateNumberOfMessagesNotVisible", 0))
175
174
  delayed = int(attrs.get("ApproximateNumberOfMessagesDelayed", 0))
176
- oldest_age_seconds = int(attrs.get("ApproximateAgeOfOldestMessage", 0))
177
175
 
178
- return {
179
- "visible": visible,
180
- "in_flight": in_flight,
181
- "delayed": delayed,
182
- "oldest_age_seconds": oldest_age_seconds,
183
- }
176
+ return {"visible": visible, "in_flight": in_flight, "delayed": delayed}
184
177
 
185
178
  except ClientError as exc:
186
179
  self.logger.error(
@@ -225,7 +218,6 @@ class SQSClient(BaseSQSClient):
225
218
  visible = metrics["visible"]
226
219
  in_flight = metrics["in_flight"]
227
220
  delayed = metrics["delayed"]
228
- oldest_age_seconds = metrics["oldest_age_seconds"]
229
221
 
230
222
  total_active = visible + in_flight
231
223
 
@@ -238,14 +230,13 @@ class SQSClient(BaseSQSClient):
238
230
  self.logger.warning(
239
231
  (
240
232
  "queue_over_capacity, topic_name=%s, "
241
- "visible=%s, in_flight=%s, delayed=%s, oldest_age_seconds=%s, "
233
+ "visible=%s, in_flight=%s, delayed=%s,"
242
234
  "total_active=%s, max_visible_capacity=%s, max_total_capacity=%s"
243
235
  ),
244
236
  self.topic_name,
245
237
  visible,
246
238
  in_flight,
247
239
  delayed,
248
- oldest_age_seconds,
249
240
  total_active,
250
241
  max_visible_capacity,
251
242
  max_total_capacity,
@@ -255,7 +246,6 @@ class SQSClient(BaseSQSClient):
255
246
  "visible_count": visible,
256
247
  "in_flight_count": in_flight,
257
248
  "delayed_count": delayed,
258
- "oldest_age_seconds": oldest_age_seconds,
259
249
  "max_visible_capacity": max_visible_capacity,
260
250
  "max_total_capacity": max_total_capacity,
261
251
  }
@@ -657,12 +647,12 @@ class AnomalySQSNotifier(SQSClient):
657
647
 
658
648
  DEFAULT_REGION = "us-east-1"
659
649
  DEFAULT_TOPIC = "reach-data-bridge-messages-queue"
650
+ SERVICE_NAME = "AnomalySQSNotifier"
660
651
 
661
652
  def __init__(
662
653
  self,
663
654
  *,
664
655
  topic_name: str = None,
665
- service_name: str = None,
666
656
  region_name: str = DEFAULT_REGION,
667
657
  logger=None,
668
658
  env: str = os.environ.get("ENV", "Staging"),
@@ -670,13 +660,12 @@ class AnomalySQSNotifier(SQSClient):
670
660
  """
671
661
  Args:
672
662
  topic_name: Nome base da fila (sem prefixo de env). Default: reach-data-bridge-messages-queue
673
- service_name: Nome do serviço para uso no message_attribute. Default: nome da classe.
674
663
  """
675
664
  if logger is None:
676
665
  logger = get_reach_logger()
677
666
 
678
667
  self.env = env
679
- self.service_name = service_name or self.__class__.__name__
668
+
680
669
  base_topic = topic_name or self.DEFAULT_TOPIC
681
670
 
682
671
  super().__init__(
@@ -684,3 +673,16 @@ class AnomalySQSNotifier(SQSClient):
684
673
  logger=logger,
685
674
  topic_name=f"{env}-{base_topic}",
686
675
  )
676
+
677
+ def notify_anomaly(
678
+ self,
679
+ message_data: dict,
680
+ delay_seconds=2,
681
+ ):
682
+ message_attributes = {"service_name": self.SERVICE_NAME}
683
+
684
+ return self.publish(
685
+ message_data=message_data,
686
+ message_attributes=message_attributes,
687
+ delay_seconds=delay_seconds,
688
+ )