port-ocean 0.24.3__py3-none-any.whl → 0.24.5__py3-none-any.whl

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.

Potentially problematic release.


This version of port-ocean might be problematic. Click here for more details.

@@ -72,13 +72,21 @@ class BaseIntegration(SyncRawMixin, SyncMixin):
72
72
 
73
73
  self.started = True
74
74
 
75
- async with event_context(
76
- EventType.START,
77
- trigger_type="machine",
78
- ):
79
- await asyncio.gather(
80
- *(listener() for listener in self.event_strategy["start"])
81
- )
75
+ if self.event_strategy["start"]:
76
+ async def run_on_start_tasks() -> None:
77
+ try:
78
+ async with event_context(
79
+ EventType.START,
80
+ trigger_type="machine",
81
+ ):
82
+ await asyncio.gather(
83
+ *(listener() for listener in self.event_strategy["start"])
84
+ )
85
+ except Exception as e:
86
+ logger.exception("Error in start event listeners: %s", str(e))
87
+
88
+ # This task will run the `on_start`s in the background and will not block the server startup
89
+ asyncio.create_task(run_on_start_tasks())
82
90
 
83
91
  logger.info("Initializing event listener")
84
92
  event_listener = await self.event_listener_factory.create_event_listener()
@@ -233,6 +233,13 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
233
233
  objects_diff = await self._calculate_raw(
234
234
  [(resource, results)], parse_all, send_raw_data_examples_amount
235
235
  )
236
+
237
+ ocean.metrics.inc_metric(
238
+ name=MetricType.OBJECT_COUNT_NAME,
239
+ labels=[ocean.metrics.current_resource_kind(), MetricPhase.TRANSFORM, MetricPhase.TransformResult.FAILED],
240
+ value=len(objects_diff[0].entity_selector_diff.failed)
241
+ )
242
+
236
243
  modified_objects = []
237
244
 
238
245
  if event.event_type == EventType.RESYNC:
@@ -395,12 +402,6 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
395
402
  value=number_of_raw_results -number_of_transformed_entities
396
403
  )
397
404
 
398
- ocean.metrics.inc_metric(
399
- name=MetricType.OBJECT_COUNT_NAME,
400
- labels=[ocean.metrics.current_resource_kind(), MetricPhase.TRANSFORM , MetricPhase.TransformResult.FAILED],
401
- value=len(errors)
402
- )
403
-
404
405
  return passed_entities, errors
405
406
 
406
407
  async def register_raw(
@@ -21,7 +21,7 @@ from port_ocean.exceptions.core import (
21
21
 
22
22
  from port_ocean.utils.async_http import _http_client
23
23
  from port_ocean.clients.port.utils import _http_client as _port_http_client
24
-
24
+ from port_ocean.helpers.metric.metric import MetricType, MetricPhase
25
25
  from port_ocean.context.ocean import ocean
26
26
 
27
27
  @contextmanager
@@ -61,6 +61,11 @@ async def resync_generator_wrapper(
61
61
  yield validate_result(result)
62
62
  except OceanAbortException as error:
63
63
  errors.append(error)
64
+ ocean.metrics.inc_metric(
65
+ name=MetricType.OBJECT_COUNT_NAME,
66
+ labels=[ocean.metrics.current_resource_kind(), MetricPhase.EXTRACT , MetricPhase.ExtractResult.FAILED],
67
+ value=1
68
+ )
64
69
  except StopAsyncIteration:
65
70
  if errors:
66
71
  raise ExceptionGroup(
@@ -37,6 +37,7 @@ class MetricPhase:
37
37
 
38
38
  class ExtractResult:
39
39
  EXTRACTED = "raw_extracted"
40
+ FAILED = "failed"
40
41
 
41
42
  class DeletionResult:
42
43
  DELETED = "deleted"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.24.3
3
+ Version: 0.24.5
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -115,14 +115,14 @@ port_ocean/core/handlers/webhook/abstract_webhook_processor.py,sha256=5KwZkdkDd5
115
115
  port_ocean/core/handlers/webhook/processor_manager.py,sha256=ipyAXoFtF84EGczyzRcZCzQG4Ippjo4eMsnVxMVz12A,12072
116
116
  port_ocean/core/handlers/webhook/webhook_event.py,sha256=9wHXLY6IGgjuqrwXXvZm_RbYEd-a9qIFNxWnGbfPv6o,3877
117
117
  port_ocean/core/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
- port_ocean/core/integrations/base.py,sha256=eS0WDOfCTim1UOQQrNuP14I6hvT_fr8dof_cr1ls01s,3107
118
+ port_ocean/core/integrations/base.py,sha256=dUhytVM9uUbcDRzG1QWyvBvEJOWZY0dPVV3hXuukOfg,3587
119
119
  port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4_RgZnwSRmTCreKcBVM,220
120
120
  port_ocean/core/integrations/mixins/events.py,sha256=2L7P3Jhp8XBqddh2_o9Cn4N261nN1SySfrEdJoqLrIw,2714
121
121
  port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
122
122
  port_ocean/core/integrations/mixins/live_events.py,sha256=8HklZmlyffYY_LeDe8xbt3Tb08rlLkqVhFF-2NQeJP4,4126
123
123
  port_ocean/core/integrations/mixins/sync.py,sha256=Vm_898pLKBwfVewtwouDWsXoxcOLicnAy6pzyqqk6U8,4053
124
- port_ocean/core/integrations/mixins/sync_raw.py,sha256=4zNsf0QdvsLANhoUTUnf0bNbHIyV7-MqQOYIr0ES85o,34121
125
- port_ocean/core/integrations/mixins/utils.py,sha256=g1XbC12dswefQ-NpcLSCqFtd_WRp2bTL98jyZ5rRbGk,3444
124
+ port_ocean/core/integrations/mixins/sync_raw.py,sha256=XCi6GoKgSFZjgx-pcQ7niDE0bQS-gwu4bCyqUbYqtiM,34158
125
+ port_ocean/core/integrations/mixins/utils.py,sha256=N76dNu1Y6UEg0_pcSdF4RO6dQIZ8EBfX3xMelgWdMxM,3779
126
126
  port_ocean/core/models.py,sha256=NYsOBtAqRgmRTb2XYGDW31IxTHSXGRQLOF64apwUZ2Q,2872
127
127
  port_ocean/core/ocean_types.py,sha256=4VipWFOHEh_d9LmWewQccwx1p2dtrRYW0YURVgNsAjo,1398
128
128
  port_ocean/core/utils/entity_topological_sorter.py,sha256=MDUjM6OuDy4Xj68o-7InNN0w1jqjxeDfeY8U02vySNI,3081
@@ -139,7 +139,7 @@ port_ocean/exceptions/utils.py,sha256=gjOqpi-HpY1l4WlMFsGA9yzhxDhajhoGGdDDyGbLnq
139
139
  port_ocean/exceptions/webhook_processor.py,sha256=yQYazg53Y-ohb7HfViwq1opH_ZUuUdhHSRxcUNveFpI,114
140
140
  port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  port_ocean/helpers/async_client.py,sha256=SRlP6o7_FCSY3UHnRlZdezppePVxxOzZ0z861vE3K40,1783
142
- port_ocean/helpers/metric/metric.py,sha256=akRZmjzQdY1WMY2O3pDuU0xyW_Tn3XGttG5CkT9_Cbo,14503
142
+ port_ocean/helpers/metric/metric.py,sha256=Aacz7bOd8ZCwEPpXAdwLbKRXf28Z4wiViG_GXiV_xWg,14529
143
143
  port_ocean/helpers/metric/utils.py,sha256=1lAgrxnZLuR_wUNDyPOPzLrm32b8cDdioob2lvnPQ1A,1619
144
144
  port_ocean/helpers/retry.py,sha256=gmS4YxM6N4fboFp7GSgtOzyBJemxs46bnrz4L4rDS6Y,16136
145
145
  port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -200,8 +200,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
200
200
  port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
201
201
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
202
202
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
203
- port_ocean-0.24.3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
204
- port_ocean-0.24.3.dist-info/METADATA,sha256=sW3iuoz4mGPzlq-YjjeF1hMaqIpjO-sGB2iaSx2AYRg,6764
205
- port_ocean-0.24.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
206
- port_ocean-0.24.3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
207
- port_ocean-0.24.3.dist-info/RECORD,,
203
+ port_ocean-0.24.5.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
204
+ port_ocean-0.24.5.dist-info/METADATA,sha256=0VdWbC6ZGVFWxt98joS9BoLC3FgafrJFrCrabRRlPiw,6764
205
+ port_ocean-0.24.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
206
+ port_ocean-0.24.5.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
207
+ port_ocean-0.24.5.dist-info/RECORD,,