PyObservability 1.0.0__py3-none-any.whl → 1.0.1__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.
- pyobservability/config/enums.py +5 -0
- pyobservability/config/settings.py +25 -13
- pyobservability/main.py +11 -0
- pyobservability/version.py +1 -1
- {pyobservability-1.0.0.dist-info → pyobservability-1.0.1.dist-info}/METADATA +2 -2
- pyobservability-1.0.1.dist-info/RECORD +16 -0
- pyobservability-1.0.0.dist-info/RECORD +0 -16
- {pyobservability-1.0.0.dist-info → pyobservability-1.0.1.dist-info}/WHEEL +0 -0
- {pyobservability-1.0.0.dist-info → pyobservability-1.0.1.dist-info}/entry_points.txt +0 -0
- {pyobservability-1.0.0.dist-info → pyobservability-1.0.1.dist-info}/licenses/LICENSE +0 -0
- {pyobservability-1.0.0.dist-info → pyobservability-1.0.1.dist-info}/top_level.txt +0 -0
pyobservability/config/enums.py
CHANGED
|
@@ -9,8 +9,24 @@ from pydantic import BaseModel, Field, FilePath, HttpUrl, PositiveInt
|
|
|
9
9
|
from pydantic.aliases import AliasChoices
|
|
10
10
|
from pydantic_settings import BaseSettings
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
from pyobservability.config import enums
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def detailed_log_config(filename: str | None = None, debug: bool = False) -> Dict[str, Any]:
|
|
16
|
+
if filename:
|
|
17
|
+
log_handler = {
|
|
18
|
+
"class": "logging.FileHandler",
|
|
19
|
+
"formatter": "default",
|
|
20
|
+
"filename": filename,
|
|
21
|
+
"mode": "a",
|
|
22
|
+
}
|
|
23
|
+
else:
|
|
24
|
+
log_handler = {
|
|
25
|
+
"class": "logging.StreamHandler",
|
|
26
|
+
"formatter": "default",
|
|
27
|
+
"stream": "ext://sys.stdout",
|
|
28
|
+
}
|
|
29
|
+
level = "DEBUG" if debug else "INFO"
|
|
14
30
|
return {
|
|
15
31
|
"version": 1,
|
|
16
32
|
"disable_existing_loggers": False,
|
|
@@ -20,19 +36,13 @@ def detailed_log_config() -> Dict[str, Any]:
|
|
|
20
36
|
"datefmt": "%b-%d-%Y %I:%M:%S %p",
|
|
21
37
|
}
|
|
22
38
|
},
|
|
23
|
-
"handlers": {
|
|
24
|
-
"default": {
|
|
25
|
-
"class": "logging.StreamHandler",
|
|
26
|
-
"formatter": "default",
|
|
27
|
-
"stream": "ext://sys.stdout",
|
|
28
|
-
}
|
|
29
|
-
},
|
|
39
|
+
"handlers": {"default": log_handler},
|
|
30
40
|
"loggers": {
|
|
31
|
-
"uvicorn": {"handlers": ["default"], "level":
|
|
32
|
-
"uvicorn.error": {"handlers": ["default"], "level":
|
|
33
|
-
"uvicorn.access": {"handlers": ["default"], "level":
|
|
41
|
+
"uvicorn": {"handlers": ["default"], "level": level},
|
|
42
|
+
"uvicorn.error": {"handlers": ["default"], "level": level, "propagate": False},
|
|
43
|
+
"uvicorn.access": {"handlers": ["default"], "level": level, "propagate": False},
|
|
34
44
|
},
|
|
35
|
-
"root": {"handlers": ["default"], "level":
|
|
45
|
+
"root": {"handlers": ["default"], "level": level},
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
|
|
@@ -89,6 +99,8 @@ class EnvConfig(PydanticEnvConfig):
|
|
|
89
99
|
targets: List[MonitorTarget] = Field(..., validation_alias=alias_choices("TARGETS"))
|
|
90
100
|
interval: PositiveInt = Field(3, validation_alias=alias_choices("INTERVAL"))
|
|
91
101
|
|
|
102
|
+
log: enums.Log | None = None
|
|
103
|
+
debug: bool = False
|
|
92
104
|
log_config: Dict[str, Any] | FilePath | None = None
|
|
93
105
|
|
|
94
106
|
username: str | None = Field(None, validation_alias=alias_choices("USERNAME"))
|
pyobservability/main.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
import pathlib
|
|
3
4
|
import warnings
|
|
5
|
+
from datetime import datetime
|
|
4
6
|
|
|
5
7
|
import uiauth
|
|
6
8
|
import uvicorn
|
|
@@ -44,6 +46,7 @@ def include_routes():
|
|
|
44
46
|
app=PyObservability,
|
|
45
47
|
username=settings.env.username,
|
|
46
48
|
password=settings.env.password,
|
|
49
|
+
custom_logger=LOGGER,
|
|
47
50
|
params=[
|
|
48
51
|
uiauth.Parameters(
|
|
49
52
|
path=enums.APIEndpoints.root,
|
|
@@ -85,6 +88,14 @@ def start(**kwargs):
|
|
|
85
88
|
port=settings.env.port,
|
|
86
89
|
app=PyObservability,
|
|
87
90
|
)
|
|
91
|
+
if log := settings.env.log:
|
|
92
|
+
if log == enums.Log.stdout:
|
|
93
|
+
uvicorn_args["log_config"] = settings.detailed_log_config(debug=settings.env.debug)
|
|
94
|
+
else:
|
|
95
|
+
log_file = datetime.now().strftime(os.path.join("logs", "pyobservability_%d-%m-%Y.log"))
|
|
96
|
+
os.makedirs("logs", exist_ok=True)
|
|
97
|
+
uvicorn_args["log_config"] = settings.detailed_log_config(filename=log_file, debug=settings.env.debug)
|
|
98
|
+
# log_config will take precedence if both log and log_config are set
|
|
88
99
|
if settings.env.log_config:
|
|
89
100
|
uvicorn_args["log_config"] = (
|
|
90
101
|
settings.env.log_config if isinstance(settings.env.log_config, dict) else str(settings.env.log_config)
|
pyobservability/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyObservability
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Lightweight OS-agnostic observability UI for PyNinja
|
|
5
5
|
Author-email: Vignesh Rao <svignesh1793@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -33,7 +33,7 @@ Project-URL: Release Notes, https://github.com/thevickypedia/PyObservability/blo
|
|
|
33
33
|
Keywords: PyObservability,observability,system-monitor,PyNinja
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
35
35
|
Classifier: Programming Language :: Python :: 3
|
|
36
|
-
Classifier: Development Status ::
|
|
36
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
37
37
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
38
38
|
Classifier: Operating System :: Microsoft :: Windows
|
|
39
39
|
Classifier: Operating System :: POSIX :: Linux
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pyobservability/__init__.py,sha256=rr4udGMbbNPl3yo7l8R3FUUVVahBtYVaW6vSWWgXlv0,2617
|
|
2
|
+
pyobservability/main.py,sha256=CI6qfOxpwIykrQXu0hYdgD16foo33IqlNHjJCtrSynA,3592
|
|
3
|
+
pyobservability/monitor.py,sha256=4Xd8k7gcOmHM-WvQpgFiDVGtzMu_RpFPZXPPoz4GoA4,6224
|
|
4
|
+
pyobservability/transport.py,sha256=FyzJAMZPn7JUZIGgxnSw3on1K6T4ciZE1EuGdAcxt_w,2188
|
|
5
|
+
pyobservability/version.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
|
|
6
|
+
pyobservability/config/enums.py,sha256=jXDtyM1_nDKgq_8gVeZULEC5EEYBzqmZWd25qsIs64I,148
|
|
7
|
+
pyobservability/config/settings.py,sha256=C2sK9VRfDBsHm8xP0PTMFAdm7K3ySwiQ0vn6Vh6wAM4,5233
|
|
8
|
+
pyobservability/static/app.js,sha256=6hjFy2jt4ndYJUI1DZT08CpuxHyWj9iSAZ2vxaTqH2A,20664
|
|
9
|
+
pyobservability/static/styles.css,sha256=dnYSXNeXd6Ohu4h8sJCO87vzPbkYcw9XVGGwB8IJbxw,4703
|
|
10
|
+
pyobservability/templates/index.html,sha256=2aQdb0QlDY5Hboev-_lJPlpnGxiC6h3fp0FlvL72S9k,5227
|
|
11
|
+
pyobservability-1.0.1.dist-info/licenses/LICENSE,sha256=_sOIKJWdD2o1WwwDIwYB2qTP2nlSWqT5Tyg9jr1Xa4w,1070
|
|
12
|
+
pyobservability-1.0.1.dist-info/METADATA,sha256=U5yMXMcpC5NVaAy2Urkt45KED7rGmSNukgMBHqsFPtg,6834
|
|
13
|
+
pyobservability-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
pyobservability-1.0.1.dist-info/entry_points.txt,sha256=DSGIr_VA8Tb3FYa2iNUYpf55eAvuFCAoInNS4ngXaME,57
|
|
15
|
+
pyobservability-1.0.1.dist-info/top_level.txt,sha256=p20T0EmihDYW1uMintRXr7X9bg3XWYKyoSbBHOVC1xI,16
|
|
16
|
+
pyobservability-1.0.1.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
pyobservability/__init__.py,sha256=rr4udGMbbNPl3yo7l8R3FUUVVahBtYVaW6vSWWgXlv0,2617
|
|
2
|
-
pyobservability/main.py,sha256=Ty0bS7ZWyKXuo-xuKoFQESvT-B-19W04d_Nk0KveNtg,3004
|
|
3
|
-
pyobservability/monitor.py,sha256=4Xd8k7gcOmHM-WvQpgFiDVGtzMu_RpFPZXPPoz4GoA4,6224
|
|
4
|
-
pyobservability/transport.py,sha256=FyzJAMZPn7JUZIGgxnSw3on1K6T4ciZE1EuGdAcxt_w,2188
|
|
5
|
-
pyobservability/version.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
|
|
6
|
-
pyobservability/config/enums.py,sha256=iMIOpa8LYSszkPIYBhupX--KrEXVTTsBurinpAxLvMA,86
|
|
7
|
-
pyobservability/config/settings.py,sha256=BjTZnkGS1pZKbN3Fq_5HQX8C6oEjWn_gVJLXcZZ6EWE,4853
|
|
8
|
-
pyobservability/static/app.js,sha256=6hjFy2jt4ndYJUI1DZT08CpuxHyWj9iSAZ2vxaTqH2A,20664
|
|
9
|
-
pyobservability/static/styles.css,sha256=dnYSXNeXd6Ohu4h8sJCO87vzPbkYcw9XVGGwB8IJbxw,4703
|
|
10
|
-
pyobservability/templates/index.html,sha256=2aQdb0QlDY5Hboev-_lJPlpnGxiC6h3fp0FlvL72S9k,5227
|
|
11
|
-
pyobservability-1.0.0.dist-info/licenses/LICENSE,sha256=_sOIKJWdD2o1WwwDIwYB2qTP2nlSWqT5Tyg9jr1Xa4w,1070
|
|
12
|
-
pyobservability-1.0.0.dist-info/METADATA,sha256=4Wj2FH4KYhsDbEntXxnMginYE9QR9AluZyYLMHvwhbg,6822
|
|
13
|
-
pyobservability-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
pyobservability-1.0.0.dist-info/entry_points.txt,sha256=DSGIr_VA8Tb3FYa2iNUYpf55eAvuFCAoInNS4ngXaME,57
|
|
15
|
-
pyobservability-1.0.0.dist-info/top_level.txt,sha256=p20T0EmihDYW1uMintRXr7X9bg3XWYKyoSbBHOVC1xI,16
|
|
16
|
-
pyobservability-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|