port-ocean 0.27.8__py3-none-any.whl → 0.27.9__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.
@@ -212,7 +212,7 @@ class IntegrationClientMixin:
212
212
  async def post_integration_sync_metrics(
213
213
  self, metrics: list[dict[str, Any]]
214
214
  ) -> None:
215
- logger.info("starting POST metrics request", metrics=metrics)
215
+ logger.debug("starting POST metrics request", metrics=metrics)
216
216
  metrics_attributes = await self.get_metrics_attributes()
217
217
  headers = await self.auth.headers()
218
218
  url = metrics_attributes["ingestUrl"] + "/syncMetrics"
@@ -224,7 +224,7 @@ class IntegrationClientMixin:
224
224
  },
225
225
  )
226
226
  handle_port_status_code(response, should_log=False)
227
- logger.info("Finished POST metrics request")
227
+ logger.debug("Finished POST metrics request")
228
228
 
229
229
  async def put_integration_sync_metrics(self, kind_metrics: dict[str, Any]) -> None:
230
230
  logger.debug("starting PUT metrics request", kind_metrics=kind_metrics)
@@ -91,6 +91,8 @@ class ResyncStateUpdater:
91
91
  value=int(status == IntegrationStateStatus.Completed),
92
92
  )
93
93
 
94
+ ocean.metrics.sync_state = status.value
95
+
94
96
  await ocean.metrics.send_metrics_to_webhook(
95
97
  kind=ocean.metrics.current_resource_kind()
96
98
  )
@@ -976,6 +976,11 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
976
976
  ocean.metrics.initialize_metrics(kinds)
977
977
  await ocean.metrics.report_sync_metrics(kinds=kinds, blueprints=blueprints)
978
978
 
979
+ async with metric_resource_context(MetricResourceKind.RUNTIME):
980
+ ocean.metrics.sync_state = SyncState.SYNCING
981
+ await ocean.metrics.send_metrics_to_webhook(kind=MetricResourceKind.RUNTIME)
982
+ await ocean.metrics.report_sync_metrics(kinds=[MetricResourceKind.RUNTIME])
983
+
979
984
  # Clear cache
980
985
  await ocean.app.cache_provider.clear()
981
986
 
@@ -1010,8 +1015,18 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
1010
1015
  logger.warning(
1011
1016
  "Resync aborted successfully, skipping delete phase. This leads to an incomplete state"
1012
1017
  )
1018
+
1019
+ async with metric_resource_context(MetricResourceKind.RUNTIME):
1020
+ ocean.metrics.sync_state = SyncState.FAILED
1021
+ await ocean.metrics.send_metrics_to_webhook(kind=MetricResourceKind.RUNTIME)
1022
+ await ocean.metrics.report_sync_metrics(kinds=[MetricResourceKind.RUNTIME])
1013
1023
  raise
1014
1024
  else:
1025
+ async with metric_resource_context(MetricResourceKind.RECONCILIATION):
1026
+ ocean.metrics.sync_state = SyncState.SYNCING
1027
+ await ocean.metrics.send_metrics_to_webhook(kind=MetricResourceKind.RECONCILIATION)
1028
+ await ocean.metrics.report_sync_metrics(kinds=[MetricResourceKind.RECONCILIATION])
1029
+
1015
1030
  success = await self.resync_reconciliation(
1016
1031
  creation_results,
1017
1032
  did_fetched_current_state,
@@ -1019,9 +1034,12 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
1019
1034
  app_config,
1020
1035
  silent,
1021
1036
  )
1022
- await ocean.metrics.report_sync_metrics(
1023
- kinds=[MetricResourceKind.RECONCILIATION]
1024
- )
1037
+
1038
+ async with metric_resource_context(MetricResourceKind.RECONCILIATION):
1039
+ ocean.metrics.sync_state = SyncState.COMPLETED if success else SyncState.FAILED
1040
+ await ocean.metrics.send_metrics_to_webhook(kind=MetricResourceKind.RECONCILIATION)
1041
+ await ocean.metrics.report_sync_metrics(kinds=[MetricResourceKind.RECONCILIATION])
1042
+
1025
1043
  return success
1026
1044
  finally:
1027
1045
  await ocean.app.cache_provider.clear()
@@ -120,7 +120,6 @@ class ProcessWrapper(multiprocessing.Process):
120
120
  logger.error(f"Process {self.pid} failed with exit code {self.exitcode}")
121
121
  else:
122
122
  logger.info(f"Process {self.pid} finished with exit code {self.exitcode}")
123
- ocean.metrics.cleanup_prometheus_metrics(self.pid)
124
123
  return super().join()
125
124
 
126
125
  def clear_http_client_context() -> None:
@@ -62,6 +62,7 @@ class SyncState:
62
62
  class MetricResourceKind:
63
63
  RECONCILIATION = "__reconciliation__"
64
64
  RESYNC = "__resync__"
65
+ RUNTIME = "__runtime__"
65
66
 
66
67
 
67
68
  # Registry for core and custom metrics
@@ -279,7 +280,7 @@ class Metrics:
279
280
  try:
280
281
  return metric_resource.metric_resource.metric_resource_kind
281
282
  except ResourceContextNotFoundError:
282
- return "__runtime__"
283
+ return MetricResourceKind.RUNTIME
283
284
 
284
285
  def generate_latest(self) -> str:
285
286
  return prometheus_client.openmetrics.exposition.generate_latest(
@@ -295,7 +296,6 @@ class Metrics:
295
296
  if kinds is None:
296
297
  return None
297
298
 
298
- logger.info("Reporting sync metrics for kinds", kinds=kinds)
299
299
  metrics = []
300
300
 
301
301
  if blueprints is None:
@@ -305,8 +305,6 @@ class Metrics:
305
305
  metric = self.generate_metrics(metric_name, kind, blueprint)
306
306
  metrics.extend(metric)
307
307
 
308
- logger.info("Generated metrics", metrics=metrics, kinds=kinds)
309
-
310
308
  try:
311
309
  await self.port_client.post_integration_sync_metrics(metrics)
312
310
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.27.8
3
+ Version: 0.27.9
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
@@ -61,7 +61,7 @@ port_ocean/clients/port/client.py,sha256=dv0mxIOde6J-wFi1FXXZkoNPVHrZzY7RSMhNkDD
61
61
  port_ocean/clients/port/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  port_ocean/clients/port/mixins/blueprints.py,sha256=aMCG4zePsMSMjMLiGrU37h5z5_ElfMzTcTvqvOI5wXY,4683
63
63
  port_ocean/clients/port/mixins/entities.py,sha256=X2NqH00eK6TMJ3a3QEQRVQlKHzyj5l1FiPkIhonnbPg,24234
64
- port_ocean/clients/port/mixins/integrations.py,sha256=ud9DQy14bJ2K3TiKqD53Dc1glp6N2x1dYFpdK96IIcc,11889
64
+ port_ocean/clients/port/mixins/integrations.py,sha256=9G1vo3n9pG1t6siUmPdYtxXbfhGXKhWAWwKHr8x7tU4,11891
65
65
  port_ocean/clients/port/mixins/migrations.py,sha256=vdL_A_NNUogvzujyaRLIoZEu5vmKDY2BxTjoGP94YzI,1467
66
66
  port_ocean/clients/port/mixins/organization.py,sha256=A2cP5V49KnjoAXxjmnm_XGth4ftPSU0qURNfnyUyS_Y,1041
67
67
  port_ocean/clients/port/retry_transport.py,sha256=PtIZOAZ6V-ncpVysRUsPOgt8Sf01QLnTKB5YeKBxkJk,1861
@@ -111,7 +111,7 @@ port_ocean/core/handlers/queue/abstract_queue.py,sha256=SaivrYbqg8qsX6wtQlJZyxgc
111
111
  port_ocean/core/handlers/queue/group_queue.py,sha256=JvvJOwz9z_aI4CjPr7yQX-0rOgqLI5wMdxWk2x5x-34,4989
112
112
  port_ocean/core/handlers/queue/local_queue.py,sha256=Y6qabDbrQ8aOPTN6Ct3lnMU7JnT8O8iTpoxMoVt6lFs,643
113
113
  port_ocean/core/handlers/resync_state_updater/__init__.py,sha256=kG6y-JQGpPfuTHh912L_bctIDCzAK4DN-d00S7rguWU,81
114
- port_ocean/core/handlers/resync_state_updater/updater.py,sha256=TRYq6QnTtPlJg6MvgZPtQdZPvkAhkvpcmWjtkxCnkg4,3764
114
+ port_ocean/core/handlers/resync_state_updater/updater.py,sha256=R7K0n-MljKtOFEh2XZKi_fBUOWIdt4X6IZIw-2WMtv0,3813
115
115
  port_ocean/core/handlers/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
116
  port_ocean/core/handlers/webhook/abstract_webhook_processor.py,sha256=5KwZkdkDd5HdVkXPzKiqabodZKl-hOtMypkTKd8Hq3M,3891
117
117
  port_ocean/core/handlers/webhook/processor_manager.py,sha256=0KRPD1ae-7w0na2AZY-rq9_gY0IaMv9LdwEh6y4_OiQ,13282
@@ -123,8 +123,8 @@ port_ocean/core/integrations/mixins/events.py,sha256=2L7P3Jhp8XBqddh2_o9Cn4N261n
123
123
  port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
124
124
  port_ocean/core/integrations/mixins/live_events.py,sha256=zM24dhNc7uHx9XYZ6toVhDADPA90EnpOmZxgDegFZbA,4196
125
125
  port_ocean/core/integrations/mixins/sync.py,sha256=Vm_898pLKBwfVewtwouDWsXoxcOLicnAy6pzyqqk6U8,4053
126
- port_ocean/core/integrations/mixins/sync_raw.py,sha256=OptSievJ1c9vw-0PKmYuT2GgbCH6HC04yEyi0MUQF9k,39351
127
- port_ocean/core/integrations/mixins/utils.py,sha256=r7VKatZDip5D0hu-chCK3IeuM1gItleOEJboNN0Zvdk,5309
126
+ port_ocean/core/integrations/mixins/sync_raw.py,sha256=50tklPFBYvVoucIcCx1yYU-gwzliXCOX7kJP6_dgsNI,40631
127
+ port_ocean/core/integrations/mixins/utils.py,sha256=ytnFX7Lyv6N3CgBnOXxYaI1cRDq5Z4NDrVFiwE6bn-M,5250
128
128
  port_ocean/core/models.py,sha256=DNbKpStMINI2lIekKprTqBevqkw_wFuFayN19w1aDfQ,2893
129
129
  port_ocean/core/ocean_types.py,sha256=bkLlTd8XfJK6_JDl0eXUHfE_NygqgiInSMwJ4YJH01Q,1399
130
130
  port_ocean/core/utils/entity_topological_sorter.py,sha256=MDUjM6OuDy4Xj68o-7InNN0w1jqjxeDfeY8U02vySNI,3081
@@ -141,7 +141,7 @@ port_ocean/exceptions/utils.py,sha256=gjOqpi-HpY1l4WlMFsGA9yzhxDhajhoGGdDDyGbLnq
141
141
  port_ocean/exceptions/webhook_processor.py,sha256=4SnkVzVwiacH_Ip4qs1hRHa6GanhnojW_TLTdQQtm7Y,363
142
142
  port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
143
  port_ocean/helpers/async_client.py,sha256=LOgUlZ5Cs_WUSc8XujCVjPGvzZ_3AuFJNKPy0FKV3fA,1987
144
- port_ocean/helpers/metric/metric.py,sha256=RwxPufa-f0j9FSOgb5JO_atlOv-JEwJJOOB1W1V0cDE,14643
144
+ port_ocean/helpers/metric/metric.py,sha256=-dw7-Eqr65AZwv0M-xPaAk98g_JS16ICBc9_UkycFbE,14543
145
145
  port_ocean/helpers/metric/utils.py,sha256=1lAgrxnZLuR_wUNDyPOPzLrm32b8cDdioob2lvnPQ1A,1619
146
146
  port_ocean/helpers/retry.py,sha256=VHAp6j9-Vid6aNR5sca3S0aW6b1S2oYw9vT9hi1N22U,18556
147
147
  port_ocean/helpers/stream.py,sha256=_UwsThzXynxWzL8OlBT1pmb2evZBi9HaaqeAGNuTuOI,2338
@@ -207,8 +207,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
207
207
  port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
208
208
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
209
209
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
210
- port_ocean-0.27.8.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
211
- port_ocean-0.27.8.dist-info/METADATA,sha256=osIO6vRaB8yTC5QRVTQbUQoguv0QuCFcNv3Js_NIVis,7015
212
- port_ocean-0.27.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
213
- port_ocean-0.27.8.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
214
- port_ocean-0.27.8.dist-info/RECORD,,
210
+ port_ocean-0.27.9.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
211
+ port_ocean-0.27.9.dist-info/METADATA,sha256=hv3PIzzmvZ97v_UfKhQGXa0-T-GUvTF3EgCzz-IrsZM,7015
212
+ port_ocean-0.27.9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
213
+ port_ocean-0.27.9.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
214
+ port_ocean-0.27.9.dist-info/RECORD,,