port-ocean 0.22.2__py3-none-any.whl → 0.22.3__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.

@@ -1,4 +1,5 @@
1
1
  import sys
2
+ import os
2
3
  from logging import LogRecord
3
4
  from logging.handlers import QueueHandler, QueueListener
4
5
  from queue import Queue
@@ -12,8 +13,9 @@ from port_ocean.log.sensetive import sensitive_log_filter
12
13
  from port_ocean.utils.signal import signal_handler
13
14
 
14
15
 
15
- def setup_logger(level: LogLevelType, enable_http_handler: bool) -> None:
16
+ def setup_logger(level: LogLevelType, enable_http_handler: bool, instance: str) -> None:
16
17
  logger.remove()
18
+ logger.configure(extra={"hostname": try_get_hostname(), "instance": instance})
17
19
  _stdout_loguru_handler(level)
18
20
  if enable_http_handler:
19
21
  _http_loguru_handler(level)
@@ -23,6 +25,8 @@ def _stdout_loguru_handler(level: LogLevelType) -> None:
23
25
  logger_format = (
24
26
  "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | "
25
27
  "<level>{level: <8}</level> | "
28
+ "<cyan>{extra[integration_id]}</cyan> | "
29
+ "<magenta>{extra[hostname]}</magenta> | "
26
30
  "<level>{message}</level>"
27
31
  )
28
32
  if level == "DEBUG":
@@ -72,3 +76,10 @@ def exception_deserializer(record: "loguru.Record") -> None:
72
76
  if exception is not None:
73
77
  fixed = Exception(str(exception.value))
74
78
  record["exception"] = exception._replace(value=fixed)
79
+
80
+
81
+ def try_get_hostname() -> str:
82
+ try:
83
+ return os.uname().nodename
84
+ except Exception:
85
+ return "unknown"
port_ocean/run.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import asyncio
2
2
  from inspect import getmembers
3
3
  from typing import Dict, Any, Type
4
+ import uuid
4
5
 
5
6
  import uvicorn
6
7
  from pydantic import BaseModel
@@ -33,11 +34,13 @@ def run(
33
34
  config_override: Dict[str, Any] | None = None,
34
35
  ) -> None:
35
36
  application_settings = ApplicationSettings(log_level=log_level, port=port)
37
+ instance = str(uuid.uuid4())
36
38
 
37
39
  init_signal_handler()
38
40
  setup_logger(
39
41
  application_settings.log_level,
40
42
  enable_http_handler=application_settings.enable_http_logging,
43
+ instance=instance,
41
44
  )
42
45
 
43
46
  config_factory = _get_default_config_factory()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.22.2
3
+ Version: 0.22.3
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
@@ -136,12 +136,12 @@ port_ocean/helpers/metric/utils.py,sha256=1DlLR9FmUOpSlWSfY_tUEGcxRQY6ckAfbD3dnM
136
136
  port_ocean/helpers/retry.py,sha256=gmS4YxM6N4fboFp7GSgtOzyBJemxs46bnrz4L4rDS6Y,16136
137
137
  port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
138
  port_ocean/log/handlers.py,sha256=ncVjgqrZRh6BhyRrA6DQG86Wsbxph1yWYuEC0cWfe-Q,3631
139
- port_ocean/log/logger_setup.py,sha256=CoEDowe5OwNOL_5clU6Z4faktfh0VWaOTS0VLmyhHjw,2404
139
+ port_ocean/log/logger_setup.py,sha256=hXaaM3D-rOeH0PpIqgm4UtRMkYvrg5DNfu5TT0_JAIs,2736
140
140
  port_ocean/log/sensetive.py,sha256=lVKiZH6b7TkrZAMmhEJRhcl67HNM94e56x12DwFgCQk,2920
141
141
  port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
142
142
  port_ocean/ocean.py,sha256=XmPmnjo-2oMZGvCLwIxPxwVNzXXzACzVR4JmlkXEOKY,7418
143
143
  port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
- port_ocean/run.py,sha256=COoRSmLG4hbsjIW5DzhV0NYVegI9xHd1POv6sg4U1No,2217
144
+ port_ocean/run.py,sha256=EsyOjkRmoUpGWFBx9duJ9SuWbYfpcDAfidqLdjK8bU8,2289
145
145
  port_ocean/sonar-project.properties,sha256=X_wLzDOkEVmpGLRMb2fg9Rb0DxWwUFSvESId8qpvrPI,73
146
146
  port_ocean/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
147
  port_ocean/tests/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -188,8 +188,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
188
188
  port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
189
189
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
190
190
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
191
- port_ocean-0.22.2.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
192
- port_ocean-0.22.2.dist-info/METADATA,sha256=Gnljw5UH_wpBycjJttdo1rAf8C8s7EeOP_KS5Ur6jWI,6764
193
- port_ocean-0.22.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
194
- port_ocean-0.22.2.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
195
- port_ocean-0.22.2.dist-info/RECORD,,
191
+ port_ocean-0.22.3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
192
+ port_ocean-0.22.3.dist-info/METADATA,sha256=K8Cam4nhmqFRa6rdvgu7p9vZ2BJvCRpHitqi3vwsZzs,6764
193
+ port_ocean-0.22.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
194
+ port_ocean-0.22.3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
195
+ port_ocean-0.22.3.dist-info/RECORD,,