PyObservability 1.1.0__py3-none-any.whl → 1.3.0__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/settings.py +2 -1
- pyobservability/main.py +8 -5
- pyobservability/static/app.js +665 -573
- pyobservability/static/styles.css +289 -79
- pyobservability/templates/index.html +175 -134
- pyobservability/version.py +1 -1
- {pyobservability-1.1.0.dist-info → pyobservability-1.3.0.dist-info}/METADATA +9 -7
- pyobservability-1.3.0.dist-info/RECORD +16 -0
- pyobservability-1.1.0.dist-info/RECORD +0 -16
- {pyobservability-1.1.0.dist-info → pyobservability-1.3.0.dist-info}/WHEEL +0 -0
- {pyobservability-1.1.0.dist-info → pyobservability-1.3.0.dist-info}/entry_points.txt +0 -0
- {pyobservability-1.1.0.dist-info → pyobservability-1.3.0.dist-info}/licenses/LICENSE +0 -0
- {pyobservability-1.1.0.dist-info → pyobservability-1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@ import socket
|
|
|
5
5
|
from typing import Any, Dict, List
|
|
6
6
|
|
|
7
7
|
import yaml
|
|
8
|
-
from pydantic import BaseModel, Field, FilePath, HttpUrl, PositiveInt
|
|
8
|
+
from pydantic import BaseModel, Field, FilePath, HttpUrl, PositiveInt
|
|
9
9
|
from pydantic.aliases import AliasChoices
|
|
10
10
|
from pydantic_settings import BaseSettings
|
|
11
11
|
|
|
@@ -129,6 +129,7 @@ class EnvConfig(PydanticEnvConfig):
|
|
|
129
129
|
|
|
130
130
|
username: str | None = Field(None, validation_alias=alias_choices("USERNAME"))
|
|
131
131
|
password: str | None = Field(None, validation_alias=alias_choices("PASSWORD"))
|
|
132
|
+
timeout: PositiveInt = Field(300, validation_alias=alias_choices("TIMEOUT"))
|
|
132
133
|
|
|
133
134
|
class Config:
|
|
134
135
|
"""Environment variables configuration."""
|
pyobservability/main.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import os
|
|
3
2
|
import pathlib
|
|
4
3
|
import warnings
|
|
5
4
|
from datetime import datetime
|
|
@@ -40,9 +39,10 @@ async def index(request: Request):
|
|
|
40
39
|
TemplateResponse:
|
|
41
40
|
Rendered HTML template with targets and version.
|
|
42
41
|
"""
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
args = dict(request=request, targets=settings.env.targets, version=__version__)
|
|
43
|
+
if settings.env.username and settings.env.password:
|
|
44
|
+
args["logout"] = uiauth.enums.APIEndpoints.fastapi_logout.value
|
|
45
|
+
return templates.TemplateResponse("index.html", args)
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
async def health() -> Dict[str, str]:
|
|
@@ -70,6 +70,7 @@ def include_routes() -> None:
|
|
|
70
70
|
app=PyObservability,
|
|
71
71
|
username=settings.env.username,
|
|
72
72
|
password=settings.env.password,
|
|
73
|
+
timeout=settings.env.timeout,
|
|
73
74
|
custom_logger=LOGGER,
|
|
74
75
|
params=[
|
|
75
76
|
uiauth.Parameters(
|
|
@@ -120,7 +121,9 @@ def start(**kwargs) -> None:
|
|
|
120
121
|
logs_path = pathlib.Path(settings.env.logs_path)
|
|
121
122
|
log_file = logs_path / f"pyobservability_{datetime.now():%d-%m-%Y}.log"
|
|
122
123
|
logs_path.mkdir(parents=True, exist_ok=True)
|
|
123
|
-
uvicorn_args["log_config"] = settings.detailed_log_config(
|
|
124
|
+
uvicorn_args["log_config"] = settings.detailed_log_config(
|
|
125
|
+
filename=log_file.resolve(), debug=settings.env.debug
|
|
126
|
+
)
|
|
124
127
|
# log_config will take precedence if both log and log_config are set
|
|
125
128
|
if settings.env.log_config:
|
|
126
129
|
uvicorn_args["log_config"] = (
|