port-ocean 0.27.7__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.
- port_ocean/core/handlers/resync_state_updater/updater.py +2 -0
- port_ocean/core/integrations/mixins/sync_raw.py +21 -3
- port_ocean/core/integrations/mixins/utils.py +0 -1
- port_ocean/helpers/metric/metric.py +13 -11
- {port_ocean-0.27.7.dist-info → port_ocean-0.27.9.dist-info}/METADATA +1 -1
- {port_ocean-0.27.7.dist-info → port_ocean-0.27.9.dist-info}/RECORD +9 -9
- {port_ocean-0.27.7.dist-info → port_ocean-0.27.9.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.27.7.dist-info → port_ocean-0.27.9.dist-info}/WHEEL +0 -0
- {port_ocean-0.27.7.dist-info → port_ocean-0.27.9.dist-info}/entry_points.txt +0 -0
@@ -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
|
-
|
1023
|
-
|
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:
|
@@ -1,21 +1,22 @@
|
|
1
1
|
import os
|
2
|
-
from typing import
|
3
|
-
|
4
|
-
from port_ocean.exceptions.context import ResourceContextNotFoundError
|
2
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
|
3
|
+
|
5
4
|
import prometheus_client
|
6
|
-
from httpx import AsyncClient
|
7
|
-
from fastapi.responses import PlainTextResponse
|
8
|
-
from loguru import logger
|
9
|
-
from port_ocean.context import metric_resource, resource
|
10
|
-
from prometheus_client import Gauge
|
11
5
|
import prometheus_client.openmetrics
|
12
6
|
import prometheus_client.openmetrics.exposition
|
13
7
|
import prometheus_client.parser
|
14
|
-
from
|
8
|
+
from fastapi import APIRouter
|
9
|
+
from fastapi.responses import PlainTextResponse
|
10
|
+
from httpx import AsyncClient
|
11
|
+
from loguru import logger
|
12
|
+
from prometheus_client import Gauge, multiprocess
|
13
|
+
|
14
|
+
from port_ocean.context import metric_resource, resource
|
15
|
+
from port_ocean.exceptions.context import ResourceContextNotFoundError
|
15
16
|
|
16
17
|
if TYPE_CHECKING:
|
17
|
-
from port_ocean.config.settings import MetricsSettings, IntegrationSettings
|
18
18
|
from port_ocean.clients.port.client import PortClient
|
19
|
+
from port_ocean.config.settings import IntegrationSettings, MetricsSettings
|
19
20
|
|
20
21
|
|
21
22
|
class MetricPhase:
|
@@ -61,6 +62,7 @@ class SyncState:
|
|
61
62
|
class MetricResourceKind:
|
62
63
|
RECONCILIATION = "__reconciliation__"
|
63
64
|
RESYNC = "__resync__"
|
65
|
+
RUNTIME = "__runtime__"
|
64
66
|
|
65
67
|
|
66
68
|
# Registry for core and custom metrics
|
@@ -278,7 +280,7 @@ class Metrics:
|
|
278
280
|
try:
|
279
281
|
return metric_resource.metric_resource.metric_resource_kind
|
280
282
|
except ResourceContextNotFoundError:
|
281
|
-
return
|
283
|
+
return MetricResourceKind.RUNTIME
|
282
284
|
|
283
285
|
def generate_latest(self) -> str:
|
284
286
|
return prometheus_client.openmetrics.exposition.generate_latest(
|
@@ -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=
|
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=
|
127
|
-
port_ocean/core/integrations/mixins/utils.py,sha256=
|
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
|
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.
|
211
|
-
port_ocean-0.27.
|
212
|
-
port_ocean-0.27.
|
213
|
-
port_ocean-0.27.
|
214
|
-
port_ocean-0.27.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|