[+] update checks service
1. make metrics in commands_typed be agnostic of fastapi, django; 2. implement ping wrapper for rest.py in checks; 3. use env settings to specify hosts to ping; 4. add pyright, ruff into Makefile; 5. test in production;
This commit is contained in:
parent
aa927da556
commit
7f2f0cbda3
@ -41,6 +41,8 @@ services:
|
|||||||
- python3
|
- python3
|
||||||
- -m
|
- -m
|
||||||
- online.fxreader.pr34.commands_typed.async_api.fastapi
|
- online.fxreader.pr34.commands_typed.async_api.fastapi
|
||||||
|
ports:
|
||||||
|
- ${CHECKS_PORTS:-"127.0.0.1:80"}:80
|
||||||
|
|
||||||
cpanel:
|
cpanel:
|
||||||
build:
|
build:
|
||||||
|
@ -5,3 +5,24 @@ venv_compile:
|
|||||||
-f deps/whl \
|
-f deps/whl \
|
||||||
requirements.in > \
|
requirements.in > \
|
||||||
requirements.txt
|
requirements.txt
|
||||||
|
|
||||||
|
venv:
|
||||||
|
uv venv -p 3.12 .venv
|
||||||
|
uv pip install \
|
||||||
|
-p .venv/bin/python3 \
|
||||||
|
-f deps/whl \
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
|
PYRIGHT_CMD ?= --threads 3
|
||||||
|
|
||||||
|
pyright:
|
||||||
|
.venv/bin/python3 \
|
||||||
|
-m pyright \
|
||||||
|
--pythonpath .venv/bin/python3 \
|
||||||
|
-p pyproject.toml \
|
||||||
|
$(PYRIGHT_CMD) \
|
||||||
|
.
|
||||||
|
|
||||||
|
RUFF_CMD ?= format
|
||||||
|
ruff:
|
||||||
|
.venv/bin/python3 -m ruff --config pyproject.toml $(RUFF_CMD) .
|
||||||
|
BIN
docker/checks/deps/whl/online_fxreader_pr34-0.1.5.27-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
docker/checks/deps/whl/online_fxreader_pr34-0.1.5.27-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
173
docker/checks/pyproject.toml
Normal file
173
docker/checks/pyproject.toml
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
[project]
|
||||||
|
description = 'checks service'
|
||||||
|
requires-python = '>= 3.10'
|
||||||
|
maintainers = [
|
||||||
|
{ name = 'Siarhei Siniak', email = 'siarheisiniak@gmail.com' },
|
||||||
|
]
|
||||||
|
classifiers = [
|
||||||
|
'Programming Language :: Python',
|
||||||
|
]
|
||||||
|
|
||||||
|
name = 'online.fxreader.pr34.checks'
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 160
|
||||||
|
target-version = 'py310'
|
||||||
|
include = [
|
||||||
|
'*.py',
|
||||||
|
'*/**/*.py',
|
||||||
|
'*/**/*.pyi',
|
||||||
|
]
|
||||||
|
exclude = [
|
||||||
|
'.venv',
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = 'single'
|
||||||
|
indent-style = 'tab'
|
||||||
|
skip-magic-trailing-comma = false
|
||||||
|
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
ignore = [
|
||||||
|
'E402', 'E722', 'E741', 'W191', 'E101', 'E501', 'I001', 'F401', 'E714',
|
||||||
|
'E713',
|
||||||
|
# remove lambdas later on
|
||||||
|
'E731',
|
||||||
|
# fix this too
|
||||||
|
'E712',
|
||||||
|
'E703',
|
||||||
|
# remove unused variables, or fix a bug
|
||||||
|
'F841',
|
||||||
|
# fix * imports
|
||||||
|
'F403',
|
||||||
|
# don't care about trailing new lines
|
||||||
|
'W292',
|
||||||
|
|
||||||
|
]
|
||||||
|
select = ['E', 'F', 'I', 'W', 'INT']
|
||||||
|
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
detect-same-package = true
|
||||||
|
relative-imports-order = "closest-to-furthest"
|
||||||
|
split-on-trailing-comma = true
|
||||||
|
section-order = [
|
||||||
|
# '__python__',
|
||||||
|
"future",
|
||||||
|
"standard-library", "third-party", "first-party", "local-folder"
|
||||||
|
]
|
||||||
|
force-wrap-aliases = true
|
||||||
|
|
||||||
|
# [tool.ruff.lint.isort.sections]
|
||||||
|
# '__python__' = ['__python__']
|
||||||
|
|
||||||
|
[tool.pylsp-mypy]
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
[tool.pyright]
|
||||||
|
include = [
|
||||||
|
'*/**/*.py',
|
||||||
|
]
|
||||||
|
extraPaths = [
|
||||||
|
'.',
|
||||||
|
]
|
||||||
|
|
||||||
|
analyzeUnannotatedFunctions = true
|
||||||
|
disableBytesTypePromotions = true
|
||||||
|
strictParameterNoneValue = true
|
||||||
|
enableTypeIgnoreComments = true
|
||||||
|
enableReachabilityAnalysis = true
|
||||||
|
strictListInference = true
|
||||||
|
strictDictionaryInference = true
|
||||||
|
strictSetInference = true
|
||||||
|
deprecateTypingAliases = false
|
||||||
|
enableExperimentalFeatures = false
|
||||||
|
reportMissingTypeStubs ="error"
|
||||||
|
reportMissingModuleSource = "warning"
|
||||||
|
reportInvalidTypeForm = "error"
|
||||||
|
reportMissingImports = "error"
|
||||||
|
reportUndefinedVariable = "error"
|
||||||
|
reportAssertAlwaysTrue = "error"
|
||||||
|
reportInvalidStringEscapeSequence = "error"
|
||||||
|
reportInvalidTypeVarUse = "error"
|
||||||
|
reportSelfClsParameterName = "error"
|
||||||
|
reportUnsupportedDunderAll = "error"
|
||||||
|
reportUnusedExpression = "error"
|
||||||
|
reportWildcardImportFromLibrary = "error"
|
||||||
|
reportAbstractUsage = "error"
|
||||||
|
reportArgumentType = "error"
|
||||||
|
reportAssertTypeFailure = "error"
|
||||||
|
reportAssignmentType = "error"
|
||||||
|
reportAttributeAccessIssue = "error"
|
||||||
|
reportCallIssue = "error"
|
||||||
|
reportGeneralTypeIssues = "error"
|
||||||
|
reportInconsistentOverload = "error"
|
||||||
|
reportIndexIssue = "error"
|
||||||
|
reportInvalidTypeArguments = "error"
|
||||||
|
reportNoOverloadImplementation = "error"
|
||||||
|
reportOperatorIssue = "error"
|
||||||
|
reportOptionalSubscript = "error"
|
||||||
|
reportOptionalMemberAccess = "error"
|
||||||
|
reportOptionalCall = "error"
|
||||||
|
reportOptionalIterable = "error"
|
||||||
|
reportOptionalContextManager = "error"
|
||||||
|
reportOptionalOperand = "error"
|
||||||
|
reportRedeclaration = "error"
|
||||||
|
reportReturnType = "error"
|
||||||
|
reportTypedDictNotRequiredAccess = "error"
|
||||||
|
reportPrivateImportUsage = "error"
|
||||||
|
reportUnboundVariable = "error"
|
||||||
|
reportUnhashable = "error"
|
||||||
|
reportUnusedCoroutine = "error"
|
||||||
|
reportUnusedExcept = "error"
|
||||||
|
reportFunctionMemberAccess = "error"
|
||||||
|
reportIncompatibleMethodOverride = "error"
|
||||||
|
reportIncompatibleVariableOverride = "error"
|
||||||
|
reportOverlappingOverload = "error"
|
||||||
|
reportPossiblyUnboundVariable = "error"
|
||||||
|
reportConstantRedefinition = "error"
|
||||||
|
#reportDeprecated = "error"
|
||||||
|
reportDeprecated = "warning"
|
||||||
|
reportDuplicateImport = "error"
|
||||||
|
reportIncompleteStub = "error"
|
||||||
|
reportInconsistentConstructor = "error"
|
||||||
|
reportInvalidStubStatement = "error"
|
||||||
|
reportMatchNotExhaustive = "error"
|
||||||
|
reportMissingParameterType = "error"
|
||||||
|
reportMissingTypeArgument = "error"
|
||||||
|
reportPrivateUsage = "error"
|
||||||
|
reportTypeCommentUsage = "error"
|
||||||
|
reportUnknownArgumentType = "error"
|
||||||
|
reportUnknownLambdaType = "error"
|
||||||
|
reportUnknownMemberType = "error"
|
||||||
|
reportUnknownParameterType = "error"
|
||||||
|
reportUnknownVariableType = "error"
|
||||||
|
#reportUnknownVariableType = "warning"
|
||||||
|
reportUnnecessaryCast = "error"
|
||||||
|
reportUnnecessaryComparison = "error"
|
||||||
|
reportUnnecessaryContains = "error"
|
||||||
|
#reportUnnecessaryIsInstance = "error"
|
||||||
|
reportUnnecessaryIsInstance = "warning"
|
||||||
|
reportUnusedClass = "error"
|
||||||
|
#reportUnusedImport = "error"
|
||||||
|
reportUnusedImport = "none"
|
||||||
|
# reportUnusedFunction = "error"
|
||||||
|
reportUnusedFunction = "warning"
|
||||||
|
#reportUnusedVariable = "error"
|
||||||
|
reportUnusedVariable = "warning"
|
||||||
|
reportUntypedBaseClass = "error"
|
||||||
|
reportUntypedClassDecorator = "error"
|
||||||
|
reportUntypedFunctionDecorator = "error"
|
||||||
|
reportUntypedNamedTuple = "error"
|
||||||
|
reportCallInDefaultInitializer = "none"
|
||||||
|
reportImplicitOverride = "none"
|
||||||
|
reportImplicitStringConcatenation = "none"
|
||||||
|
reportImportCycles = "none"
|
||||||
|
reportMissingSuperCall = "none"
|
||||||
|
reportPropertyTypeMismatch = "none"
|
||||||
|
reportShadowedImports = "none"
|
||||||
|
reportUninitializedInstanceVariable = "none"
|
||||||
|
reportUnnecessaryTypeIgnoreComment = "none"
|
||||||
|
reportUnusedCallResult = "none"
|
||||||
|
|
@ -1,3 +1,4 @@
|
|||||||
online.fxreader.pr34[django,fastapi]>=0.1.5.24
|
online.fxreader.pr34[django,fastapi,lint]>=0.1.5.24
|
||||||
fastapi
|
fastapi
|
||||||
uvicorn
|
uvicorn
|
||||||
|
numpy
|
||||||
|
@ -23,7 +23,18 @@ click==8.2.1 \
|
|||||||
django==5.2.5 \
|
django==5.2.5 \
|
||||||
--hash=sha256:0745b25681b129a77aae3d4f6549b62d3913d74407831abaa0d9021a03954bae \
|
--hash=sha256:0745b25681b129a77aae3d4f6549b62d3913d74407831abaa0d9021a03954bae \
|
||||||
--hash=sha256:2b2ada0ee8a5ff743a40e2b9820d1f8e24c11bac9ae6469cd548f0057ea6ddcd
|
--hash=sha256:2b2ada0ee8a5ff743a40e2b9820d1f8e24c11bac9ae6469cd548f0057ea6ddcd
|
||||||
|
# via
|
||||||
|
# django-stubs
|
||||||
|
# django-stubs-ext
|
||||||
|
# online-fxreader-pr34
|
||||||
|
django-stubs==5.2.2 \
|
||||||
|
--hash=sha256:2a04b510c7a812f88223fd7e6d87fb4ea98717f19c8e5c8b59691d83ad40a8a6 \
|
||||||
|
--hash=sha256:79bd0fdbc78958a8f63e0b062bd9d03f1de539664476c0be62ade5f063c9e41e
|
||||||
# via online-fxreader-pr34
|
# via online-fxreader-pr34
|
||||||
|
django-stubs-ext==5.2.2 \
|
||||||
|
--hash=sha256:8833bbe32405a2a0ce168d3f75a87168f61bd16939caf0e8bf173bccbd8a44c5 \
|
||||||
|
--hash=sha256:d9d151b919fe2438760f5bd938f03e1cb08c84d0651f9e5917f1313907e42683
|
||||||
|
# via django-stubs
|
||||||
fastapi==0.116.1 \
|
fastapi==0.116.1 \
|
||||||
--hash=sha256:c46ac7c312df840f0c9e220f7964bada936781bc4e2e6eb71f1c4d7553786565 \
|
--hash=sha256:c46ac7c312df840f0c9e220f7964bada936781bc4e2e6eb71f1c4d7553786565 \
|
||||||
--hash=sha256:ed52cbf946abfd70c5a0dccb24673f0670deeb517a88b3544d03c2a6bf283143
|
--hash=sha256:ed52cbf946abfd70c5a0dccb24673f0670deeb517a88b3544d03c2a6bf283143
|
||||||
@ -149,8 +160,88 @@ mypy-extensions==1.1.0 \
|
|||||||
--hash=sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505 \
|
--hash=sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505 \
|
||||||
--hash=sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558
|
--hash=sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558
|
||||||
# via mypy
|
# via mypy
|
||||||
online-fxreader-pr34==0.1.5.26 \
|
nodeenv==1.9.1 \
|
||||||
--hash=sha256:3066558ef4a5dd2dfda85c3d9fb7d50014774d500187da86c6cc0795fca3be10
|
--hash=sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f \
|
||||||
|
--hash=sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9
|
||||||
|
# via pyright
|
||||||
|
numpy==2.3.2 \
|
||||||
|
--hash=sha256:07b62978075b67eee4065b166d000d457c82a1efe726cce608b9db9dd66a73a5 \
|
||||||
|
--hash=sha256:087ffc25890d89a43536f75c5fe8770922008758e8eeeef61733957041ed2f9b \
|
||||||
|
--hash=sha256:092aeb3449833ea9c0bf0089d70c29ae480685dd2377ec9cdbbb620257f84631 \
|
||||||
|
--hash=sha256:095737ed986e00393ec18ec0b21b47c22889ae4b0cd2d5e88342e08b01141f58 \
|
||||||
|
--hash=sha256:0a4f2021a6da53a0d580d6ef5db29947025ae8b35b3250141805ea9a32bbe86b \
|
||||||
|
--hash=sha256:103ea7063fa624af04a791c39f97070bf93b96d7af7eb23530cd087dc8dbe9dc \
|
||||||
|
--hash=sha256:11e58218c0c46c80509186e460d79fbdc9ca1eb8d8aee39d8f2dc768eb781089 \
|
||||||
|
--hash=sha256:122bf5ed9a0221b3419672493878ba4967121514b1d7d4656a7580cd11dddcbf \
|
||||||
|
--hash=sha256:14a91ebac98813a49bc6aa1a0dfc09513dcec1d97eaf31ca21a87221a1cdcb15 \
|
||||||
|
--hash=sha256:1f91e5c028504660d606340a084db4b216567ded1056ea2b4be4f9d10b67197f \
|
||||||
|
--hash=sha256:20b8200721840f5621b7bd03f8dcd78de33ec522fc40dc2641aa09537df010c3 \
|
||||||
|
--hash=sha256:240259d6564f1c65424bcd10f435145a7644a65a6811cfc3201c4a429ba79170 \
|
||||||
|
--hash=sha256:2738534837c6a1d0c39340a190177d7d66fdf432894f469728da901f8f6dc910 \
|
||||||
|
--hash=sha256:27c9f90e7481275c7800dc9c24b7cc40ace3fdb970ae4d21eaff983a32f70c91 \
|
||||||
|
--hash=sha256:293b2192c6bcce487dbc6326de5853787f870aeb6c43f8f9c6496db5b1781e45 \
|
||||||
|
--hash=sha256:2c3271cc4097beb5a60f010bcc1cc204b300bb3eafb4399376418a83a1c6373c \
|
||||||
|
--hash=sha256:2f4f0215edb189048a3c03bd5b19345bdfa7b45a7a6f72ae5945d2a28272727f \
|
||||||
|
--hash=sha256:3dcf02866b977a38ba3ec10215220609ab9667378a9e2150615673f3ffd6c73b \
|
||||||
|
--hash=sha256:4209f874d45f921bde2cff1ffcd8a3695f545ad2ffbef6d3d3c6768162efab89 \
|
||||||
|
--hash=sha256:448a66d052d0cf14ce9865d159bfc403282c9bc7bb2a31b03cc18b651eca8b1a \
|
||||||
|
--hash=sha256:4ae6863868aaee2f57503c7a5052b3a2807cf7a3914475e637a0ecd366ced220 \
|
||||||
|
--hash=sha256:4d002ecf7c9b53240be3bb69d80f86ddbd34078bae04d87be81c1f58466f264e \
|
||||||
|
--hash=sha256:4e6ecfeddfa83b02318f4d84acf15fbdbf9ded18e46989a15a8b6995dfbf85ab \
|
||||||
|
--hash=sha256:508b0eada3eded10a3b55725b40806a4b855961040180028f52580c4729916a2 \
|
||||||
|
--hash=sha256:546aaf78e81b4081b2eba1d105c3b34064783027a06b3ab20b6eba21fb64132b \
|
||||||
|
--hash=sha256:572d5512df5470f50ada8d1972c5f1082d9a0b7aa5944db8084077570cf98370 \
|
||||||
|
--hash=sha256:5ad4ebcb683a1f99f4f392cc522ee20a18b2bb12a2c1c42c3d48d5a1adc9d3d2 \
|
||||||
|
--hash=sha256:66459dccc65d8ec98cc7df61307b64bf9e08101f9598755d42d8ae65d9a7a6ee \
|
||||||
|
--hash=sha256:6936aff90dda378c09bea075af0d9c675fe3a977a9d2402f95a87f440f59f619 \
|
||||||
|
--hash=sha256:69779198d9caee6e547adb933941ed7520f896fd9656834c300bdf4dd8642712 \
|
||||||
|
--hash=sha256:6f1ae3dcb840edccc45af496f312528c15b1f79ac318169d094e85e4bb35fdf1 \
|
||||||
|
--hash=sha256:71669b5daae692189540cffc4c439468d35a3f84f0c88b078ecd94337f6cb0ec \
|
||||||
|
--hash=sha256:72c6df2267e926a6d5286b0a6d556ebe49eae261062059317837fda12ddf0c1a \
|
||||||
|
--hash=sha256:72dbebb2dcc8305c431b2836bcc66af967df91be793d63a24e3d9b741374c450 \
|
||||||
|
--hash=sha256:754d6755d9a7588bdc6ac47dc4ee97867271b17cee39cb87aef079574366db0a \
|
||||||
|
--hash=sha256:76c3e9501ceb50b2ff3824c3589d5d1ab4ac857b0ee3f8f49629d0de55ecf7c2 \
|
||||||
|
--hash=sha256:7a0e27186e781a69959d0230dd9909b5e26024f8da10683bd6344baea1885168 \
|
||||||
|
--hash=sha256:7d6e390423cc1f76e1b8108c9b6889d20a7a1f59d9a60cac4a050fa734d6c1e2 \
|
||||||
|
--hash=sha256:8145dd6d10df13c559d1e4314df29695613575183fa2e2d11fac4c208c8a1f73 \
|
||||||
|
--hash=sha256:8446acd11fe3dc1830568c941d44449fd5cb83068e5c70bd5a470d323d448296 \
|
||||||
|
--hash=sha256:852ae5bed3478b92f093e30f785c98e0cb62fa0a939ed057c31716e18a7a22b9 \
|
||||||
|
--hash=sha256:87c930d52f45df092f7578889711a0768094debf73cfcde105e2d66954358125 \
|
||||||
|
--hash=sha256:8b1224a734cd509f70816455c3cffe13a4f599b1bf7130f913ba0e2c0b2006c0 \
|
||||||
|
--hash=sha256:8dc082ea901a62edb8f59713c6a7e28a85daddcb67454c839de57656478f5b19 \
|
||||||
|
--hash=sha256:906a30249315f9c8e17b085cc5f87d3f369b35fedd0051d4a84686967bdbbd0b \
|
||||||
|
--hash=sha256:938065908d1d869c7d75d8ec45f735a034771c6ea07088867f713d1cd3bbbe4f \
|
||||||
|
--hash=sha256:9c144440db4bf3bb6372d2c3e49834cc0ff7bb4c24975ab33e01199e645416f2 \
|
||||||
|
--hash=sha256:9e196ade2400c0c737d93465327d1ae7c06c7cb8a1756121ebf54b06ca183c7f \
|
||||||
|
--hash=sha256:a3ef07ec8cbc8fc9e369c8dcd52019510c12da4de81367d8b20bc692aa07573a \
|
||||||
|
--hash=sha256:a7af9ed2aa9ec5950daf05bb11abc4076a108bd3c7db9aa7251d5f107079b6a6 \
|
||||||
|
--hash=sha256:a9f66e7d2b2d7712410d3bc5684149040ef5f19856f20277cd17ea83e5006286 \
|
||||||
|
--hash=sha256:aa098a5ab53fa407fded5870865c6275a5cd4101cfdef8d6fafc48286a96e981 \
|
||||||
|
--hash=sha256:af58de8745f7fa9ca1c0c7c943616c6fe28e75d0c81f5c295810e3c83b5be92f \
|
||||||
|
--hash=sha256:b05a89f2fb84d21235f93de47129dd4f11c16f64c87c33f5e284e6a3a54e43f2 \
|
||||||
|
--hash=sha256:b5e40e80299607f597e1a8a247ff8d71d79c5b52baa11cc1cce30aa92d2da6e0 \
|
||||||
|
--hash=sha256:b9d0878b21e3918d76d2209c924ebb272340da1fb51abc00f986c258cd5e957b \
|
||||||
|
--hash=sha256:bc3186bea41fae9d8e90c2b4fb5f0a1f5a690682da79b92574d63f56b529080b \
|
||||||
|
--hash=sha256:c63d95dc9d67b676e9108fe0d2182987ccb0f11933c1e8959f42fa0da8d4fa56 \
|
||||||
|
--hash=sha256:c771cfac34a4f2c0de8e8c97312d07d64fd8f8ed45bc9f5726a7e947270152b5 \
|
||||||
|
--hash=sha256:c8d9727f5316a256425892b043736d63e89ed15bbfe6556c5ff4d9d4448ff3b3 \
|
||||||
|
--hash=sha256:cbc95b3813920145032412f7e33d12080f11dc776262df1712e1638207dde9e8 \
|
||||||
|
--hash=sha256:cefc2219baa48e468e3db7e706305fcd0c095534a192a08f31e98d83a7d45fb0 \
|
||||||
|
--hash=sha256:d95f59afe7f808c103be692175008bab926b59309ade3e6d25009e9a171f7036 \
|
||||||
|
--hash=sha256:dd937f088a2df683cbb79dda9a772b62a3e5a8a7e76690612c2737f38c6ef1b6 \
|
||||||
|
--hash=sha256:de6ea4e5a65d5a90c7d286ddff2b87f3f4ad61faa3db8dabe936b34c2275b6f8 \
|
||||||
|
--hash=sha256:e0486a11ec30cdecb53f184d496d1c6a20786c81e55e41640270130056f8ee48 \
|
||||||
|
--hash=sha256:ee807923782faaf60d0d7331f5e86da7d5e3079e28b291973c545476c2b00d07 \
|
||||||
|
--hash=sha256:efc81393f25f14d11c9d161e46e6ee348637c0a1e8a54bf9dedc472a3fae993b \
|
||||||
|
--hash=sha256:f0a1a8476ad77a228e41619af2fa9505cf69df928e9aaa165746584ea17fed2b \
|
||||||
|
--hash=sha256:f75018be4980a7324edc5930fe39aa391d5734531b1926968605416ff58c332d \
|
||||||
|
--hash=sha256:f92d6c2a8535dc4fe4419562294ff957f83a16ebdec66df0805e473ffaad8bd0 \
|
||||||
|
--hash=sha256:fb1752a3bb9a3ad2d6b090b88a9a0ae1cd6f004ef95f75825e2f382c183b2097 \
|
||||||
|
--hash=sha256:fc927d7f289d14f5e037be917539620603294454130b6de200091e23d27dc9be \
|
||||||
|
--hash=sha256:fed5527c4cf10f16c6d0b6bee1f89958bccb0ad2522c8cadc2efd318bcd545f5
|
||||||
|
# via -r requirements.in
|
||||||
|
online-fxreader-pr34==0.1.5.27 \
|
||||||
|
--hash=sha256:d081758fdb91fb460da5c55d3a38257122de096363a8d956ba2f91a234566010
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
pathspec==0.12.1 \
|
pathspec==0.12.1 \
|
||||||
--hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \
|
--hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \
|
||||||
@ -272,6 +363,10 @@ pydantic-settings==2.10.1 \
|
|||||||
--hash=sha256:06f0062169818d0f5524420a360d632d5857b83cffd4d42fe29597807a1614ee \
|
--hash=sha256:06f0062169818d0f5524420a360d632d5857b83cffd4d42fe29597807a1614ee \
|
||||||
--hash=sha256:a60952460b99cf661dc25c29c0ef171721f98bfcb52ef8d9ea4c943d7c8cc796
|
--hash=sha256:a60952460b99cf661dc25c29c0ef171721f98bfcb52ef8d9ea4c943d7c8cc796
|
||||||
# via online-fxreader-pr34
|
# via online-fxreader-pr34
|
||||||
|
pyright==1.1.404 \
|
||||||
|
--hash=sha256:455e881a558ca6be9ecca0b30ce08aa78343ecc031d37a198ffa9a7a1abeb63e \
|
||||||
|
--hash=sha256:c7b7ff1fdb7219c643079e4c3e7d4125f0dafcc19d253b47e898d130ea426419
|
||||||
|
# via online-fxreader-pr34
|
||||||
python-dotenv==1.1.1 \
|
python-dotenv==1.1.1 \
|
||||||
--hash=sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc \
|
--hash=sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc \
|
||||||
--hash=sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab
|
--hash=sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab
|
||||||
@ -331,6 +426,27 @@ pyyaml==6.0.2 \
|
|||||||
--hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \
|
--hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \
|
||||||
--hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4
|
--hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4
|
||||||
# via yq
|
# via yq
|
||||||
|
ruff==0.12.11 \
|
||||||
|
--hash=sha256:0d737b4059d66295c3ea5720e6efc152623bb83fde5444209b69cd33a53e2000 \
|
||||||
|
--hash=sha256:411954eca8464595077a93e580e2918d0a01a19317af0a72132283e28ae21bee \
|
||||||
|
--hash=sha256:4d1df0098124006f6a66ecf3581a7f7e754c4df7644b2e6704cd7ca80ff95211 \
|
||||||
|
--hash=sha256:4dc75533039d0ed04cd33fb8ca9ac9620b99672fe7ff1533b6402206901c34ee \
|
||||||
|
--hash=sha256:4fc58f9266d62c6eccc75261a665f26b4ef64840887fc6cbc552ce5b29f96cc8 \
|
||||||
|
--hash=sha256:5a0113bd6eafd545146440225fe60b4e9489f59eb5f5f107acd715ba5f0b3d2f \
|
||||||
|
--hash=sha256:5a8dd5f230efc99a24ace3b77e3555d3fbc0343aeed3fc84c8d89e75ab2ff793 \
|
||||||
|
--hash=sha256:6a2c0a2e1a450f387bf2c6237c727dd22191ae8c00e448e0672d624b2bbd7fb0 \
|
||||||
|
--hash=sha256:8ca4c3a7f937725fd2413c0e884b5248a19369ab9bdd850b5781348ba283f644 \
|
||||||
|
--hash=sha256:916fc5defee32dbc1fc1650b576a8fed68f5e8256e2180d4d9855aea43d6aab2 \
|
||||||
|
--hash=sha256:93fce71e1cac3a8bf9200e63a38ac5c078f3b6baebffb74ba5274fb2ab276065 \
|
||||||
|
--hash=sha256:a3283325960307915b6deb3576b96919ee89432ebd9c48771ca12ee8afe4a0fd \
|
||||||
|
--hash=sha256:b8e33ac7b28c772440afa80cebb972ffd823621ded90404f29e5ab6d1e2d4b93 \
|
||||||
|
--hash=sha256:bae4d6e6a2676f8fb0f98b74594a048bae1b944aab17e9f5d504062303c6dbea \
|
||||||
|
--hash=sha256:c6b09ae8426a65bbee5425b9d0b82796dbb07cb1af045743c79bfb163001165d \
|
||||||
|
--hash=sha256:c792e8f597c9c756e9bcd4d87cf407a00b60af77078c96f7b6366ea2ce9ba9d3 \
|
||||||
|
--hash=sha256:c984f07d7adb42d3ded5be894fb4007f30f82c87559438b4879fe7aa08c62b39 \
|
||||||
|
--hash=sha256:d69fb9d4937aa19adb2e9f058bc4fbfe986c2040acb1a4a9747734834eaa0bfd \
|
||||||
|
--hash=sha256:e07fbb89f2e9249f219d88331c833860489b49cdf4b032b8e4432e9b13e8a4b9
|
||||||
|
# via online-fxreader-pr34
|
||||||
sniffio==1.3.1 \
|
sniffio==1.3.1 \
|
||||||
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
|
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
|
||||||
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
||||||
@ -343,6 +459,40 @@ starlette==0.47.3 \
|
|||||||
--hash=sha256:6bc94f839cc176c4858894f1f8908f0ab79dfec1a6b8402f6da9be26ebea52e9 \
|
--hash=sha256:6bc94f839cc176c4858894f1f8908f0ab79dfec1a6b8402f6da9be26ebea52e9 \
|
||||||
--hash=sha256:89c0778ca62a76b826101e7c709e70680a1699ca7da6b44d38eb0a7e61fe4b51
|
--hash=sha256:89c0778ca62a76b826101e7c709e70680a1699ca7da6b44d38eb0a7e61fe4b51
|
||||||
# via fastapi
|
# via fastapi
|
||||||
|
tomli==2.2.1 \
|
||||||
|
--hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \
|
||||||
|
--hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \
|
||||||
|
--hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \
|
||||||
|
--hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \
|
||||||
|
--hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \
|
||||||
|
--hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \
|
||||||
|
--hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \
|
||||||
|
--hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \
|
||||||
|
--hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \
|
||||||
|
--hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \
|
||||||
|
--hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \
|
||||||
|
--hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \
|
||||||
|
--hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \
|
||||||
|
--hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \
|
||||||
|
--hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \
|
||||||
|
--hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \
|
||||||
|
--hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \
|
||||||
|
--hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \
|
||||||
|
--hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \
|
||||||
|
--hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \
|
||||||
|
--hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \
|
||||||
|
--hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \
|
||||||
|
--hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \
|
||||||
|
--hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \
|
||||||
|
--hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \
|
||||||
|
--hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \
|
||||||
|
--hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \
|
||||||
|
--hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \
|
||||||
|
--hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \
|
||||||
|
--hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \
|
||||||
|
--hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \
|
||||||
|
--hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7
|
||||||
|
# via online-fxreader-pr34
|
||||||
tomlkit==0.13.3 \
|
tomlkit==0.13.3 \
|
||||||
--hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \
|
--hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \
|
||||||
--hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0
|
--hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0
|
||||||
@ -353,15 +503,22 @@ tomlq==0.1.0 \
|
|||||||
--hash=sha256:4b966fd999ed2bf69081b7c7f5caadbc4c9542d0ed5fcf2e9b7b4d8d7ada3c82 \
|
--hash=sha256:4b966fd999ed2bf69081b7c7f5caadbc4c9542d0ed5fcf2e9b7b4d8d7ada3c82 \
|
||||||
--hash=sha256:e775720e90da3e405142b9fe476145e71c0389f787b1ff9933f92a1704d8c6e7
|
--hash=sha256:e775720e90da3e405142b9fe476145e71c0389f787b1ff9933f92a1704d8c6e7
|
||||||
# via online-fxreader-pr34
|
# via online-fxreader-pr34
|
||||||
|
types-pyyaml==6.0.12.20250822 \
|
||||||
|
--hash=sha256:1fe1a5e146aa315483592d292b72a172b65b946a6d98aa6ddd8e4aa838ab7098 \
|
||||||
|
--hash=sha256:259f1d93079d335730a9db7cff2bcaf65d7e04b4a56b5927d49a612199b59413
|
||||||
|
# via django-stubs
|
||||||
typing-extensions==4.15.0 \
|
typing-extensions==4.15.0 \
|
||||||
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
|
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
|
||||||
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
|
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
|
||||||
# via
|
# via
|
||||||
# anyio
|
# anyio
|
||||||
|
# django-stubs
|
||||||
|
# django-stubs-ext
|
||||||
# fastapi
|
# fastapi
|
||||||
# mypy
|
# mypy
|
||||||
# pydantic
|
# pydantic
|
||||||
# pydantic-core
|
# pydantic-core
|
||||||
|
# pyright
|
||||||
# starlette
|
# starlette
|
||||||
# typing-inspection
|
# typing-inspection
|
||||||
typing-inspection==0.4.1 \
|
typing-inspection==0.4.1 \
|
||||||
|
@ -1,13 +1,95 @@
|
|||||||
import fastapi
|
import fastapi
|
||||||
from online.fxreader.pr34.commands_typed import metrics
|
import re
|
||||||
|
import numpy
|
||||||
|
import subprocess
|
||||||
|
import fastapi.responses
|
||||||
|
import pydantic_settings
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
from online.fxreader.pr34.commands_typed import metrics as pr34_metrics
|
||||||
|
|
||||||
|
from typing import Optional, Any, ClassVar
|
||||||
|
|
||||||
|
|
||||||
|
class Settings(pydantic_settings.BaseSettings):
|
||||||
|
checks_hosts: list[str]
|
||||||
|
|
||||||
|
_singleton: ClassVar[Optional['Settings']] = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def singleton(cls) -> 'Settings':
|
||||||
|
if cls._singleton is None:
|
||||||
|
cls._singleton = Settings.model_validate({})
|
||||||
|
|
||||||
|
return cls._singleton
|
||||||
|
|
||||||
|
|
||||||
|
def ping_stats(host: str) -> Optional[float]:
|
||||||
|
try:
|
||||||
|
ping_output = subprocess.check_output(
|
||||||
|
[
|
||||||
|
'ping',
|
||||||
|
'-i',
|
||||||
|
'0.1',
|
||||||
|
'-c',
|
||||||
|
'3',
|
||||||
|
'-w',
|
||||||
|
'1',
|
||||||
|
host,
|
||||||
|
]
|
||||||
|
).decode('utf-8')
|
||||||
|
except:
|
||||||
|
logger.exception('')
|
||||||
|
|
||||||
|
ping_output = ''
|
||||||
|
|
||||||
|
r1 = re.compile(r'time=(\d+\.\d+)\sms')
|
||||||
|
|
||||||
|
spend_time = [float(o[1]) for o in r1.finditer(ping_output)]
|
||||||
|
|
||||||
|
if len(spend_time) == 0:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return float(numpy.mean(spend_time))
|
||||||
|
|
||||||
|
|
||||||
|
async def metrics_get() -> fastapi.responses.Response:
|
||||||
|
ping_res = {h: ping_stats(h) for h in Settings.singleton().checks_hosts}
|
||||||
|
|
||||||
|
metrics = [
|
||||||
|
pr34_metrics.Metric.model_validate(
|
||||||
|
dict(
|
||||||
|
name='ping_mean',
|
||||||
|
type='gauge',
|
||||||
|
help='ping to host, 3 counts, up to 1 second',
|
||||||
|
samples=[
|
||||||
|
dict(
|
||||||
|
value=str(v),
|
||||||
|
parameters=dict(
|
||||||
|
host=k,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for k, v in ping_res.items()
|
||||||
|
if not v is None
|
||||||
|
]
|
||||||
|
serialize_res = pr34_metrics.serialize(metrics)
|
||||||
|
|
||||||
|
return fastapi.responses.Response(
|
||||||
|
content=serialize_res.json2,
|
||||||
|
headers={
|
||||||
|
'Content-Type': serialize_res.content_type,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def get_router() -> fastapi.APIRouter:
|
def get_router() -> fastapi.APIRouter:
|
||||||
router = fastapi.APIRouter()
|
router = fastapi.APIRouter()
|
||||||
|
|
||||||
return router
|
router.get('/metrics')(metrics_get)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
return router
|
||||||
main()
|
|
||||||
|
@ -5,7 +5,7 @@ project(
|
|||||||
).stdout().strip('\n'),
|
).stdout().strip('\n'),
|
||||||
# 'online.fxreader.uv',
|
# 'online.fxreader.uv',
|
||||||
# ['c', 'cpp'],
|
# ['c', 'cpp'],
|
||||||
version: '0.1.5.26',
|
version: '0.1.5.27',
|
||||||
# default_options: [
|
# default_options: [
|
||||||
# 'cpp_std=c++23',
|
# 'cpp_std=c++23',
|
||||||
# # 'prefer_static=true',
|
# # 'prefer_static=true',
|
||||||
|
@ -3,7 +3,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import django.http
|
# import django.http
|
||||||
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Literal,
|
Literal,
|
||||||
@ -72,11 +72,17 @@ class Metric(pydantic.BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class serialize_t:
|
||||||
|
class res_t(pydantic.BaseModel):
|
||||||
|
json2: str
|
||||||
|
content_type: str
|
||||||
|
|
||||||
|
|
||||||
def serialize(
|
def serialize(
|
||||||
metrics: list[Metric],
|
metrics: list[Metric],
|
||||||
):
|
):
|
||||||
return django.http.HttpResponse(
|
return serialize_t.res_t(
|
||||||
''.join(
|
json2=''.join(
|
||||||
[
|
[
|
||||||
'{help}{type}{samples}'.format(
|
'{help}{type}{samples}'.format(
|
||||||
# help='# HELP %s some metric' % o.name,
|
# help='# HELP %s some metric' % o.name,
|
||||||
|
BIN
releases/whl/online_fxreader_pr34-0.1.5.27-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.27-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user