Skip to main content

smart-health-record

在服務內記錄各節點的事實(開始、成功、錯誤、致命故障、指標),由獨立的評估執行緒推導健康狀態,並以 GET /topology、GET /status 提供給 Health App 讀取。

  • 執行時只使用 Python 標準函式庫,需要 Python 3.10 以上。
  • 公開 API:HealthMonitor、NodeRecorder、StatusServer、mask_text、__version__。
  • NodeRecorder 由 add_node() 回傳;之後也可以用 monitor.recorder(node_id) 依節點 id 取得同一個物件,不存在時拋 KeyError。
  • message 與字串型指標值會自動遮蔽密碼、token、URL 帳密等敏感資訊(有已知限制,見導入指南)。

安裝

pip install smart-health-record==0.1.1

最小範例

from smart_health_record import HealthMonitor, StatusServer

monitor = HealthMonitor("order-service", "order-1")
monitor.add_lane("main", "主流程")
worker = monitor.add_node("worker", "訂單處理", "main", stale_after_s=10)

monitor.start()
StatusServer(monitor, port=18090).start()   # port 必填;預設只綁定 127.0.0.1

with worker.track():                        # 進入記 start,正常離開記 success,例外記 error 並往外拋
    ...                                     # 處理一筆工作

之後 curl http://127.0.0.1:18090/status 即可取得狀態。

文件

  • 導入指南(callable 不能阻塞、port 由專案指定、遮蔽的已知限制等):docs/INTEGRATION.md
  • 契約:contract/README.md
  • 規格:docs/SPEC.md 第 5 節

Metadata

Release files for smart-health-record 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smart-health-record 0.1.1
File Size Uploaded Provenance Actions
smart_health_record-0.1.1.tar.gz 17.4 kB Without provenance Details for smart_health_record-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smart-health-record 0.1.1
File Interpreter ABI Platform Actions
smart_health_record-0.1.1-py3-none-any.whl Python 3 none any Details for smart_health_record-0.1.1-py3-none-any.whl

Total release size: 40.9 kB

Release files / smart_health_record-0.1.1.tar.gz

Download URL smart_health_record-0.1.1.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b2850a360e9509095cb10ea0393d19a0ddef6c0afc0d9b3ac09ff61b2ede4e4
BLAKE2b-256 checksum
How to use checksums
162e0da060b7b16fbdd5625dad8e7f2f25fb813be7c46db1bdb9ef5e8e0ec69a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / smart_health_record-0.1.1-py3-none-any.whl

Download URL smart_health_record-0.1.1-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25844b3f620cfd0e93de559034bcda41f651f99d0902e3331cabe0f0bb4cb598
BLAKE2b-256 checksum
How to use checksums
bec4019454e6ba040e8d6e09617c7d1a686bb52e1e66859035b0f48c82a5c095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Security for smart-health-record 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page