cznic/public/: fred-diagonal-3.0.0 metadata and description
Diagonal - a client library for Fred service diagnostics
author | Jan MusĂlek |
author_email | jan.musilek@nic.cz |
classifiers |
|
license | GPLv3+ |
provides_extras | types |
requires_dist |
|
requires_python | ~=3.9 |
Because this project isn't in the mirror_whitelist
,
no releases from root/pypi are included.
File | Tox results | History |
---|---|---|
fred_diagonal-3.0.0-py3-none-any.whl
|
|
|
fred_diagonal-3.0.0.tar.gz
|
|
A library for FRED service diagnostics, usable for both the client & server side.
Client usage
DiagnosticsClient is a low-level client to obtain particular information from a single server.
from diagonal import DiagnosticsClient async def print_localhost(): client = DiagnosticsClient("localhost:2240") about = await client.about() print(f"Server version: {about.server_version}, providing {len(about.api_versions)} APIs.") status = await client.status() print("Status of services:") for service_name, service_info in status.items(): print(f"- {service_name}: {service_info.status}, note: {service_info.note}")
Use collect_server_diagnostics to collect diagnostic information from multiple servers.
from diagonal import collect_server_diagnostics from diagonal.schema import Server async def print_summary() -> None: servers = [Server(netloc="server1:2240"), Server(netloc="server2:2250")] diag = await collect_server_diagnostics(servers) print(f"Collected diagnostics from {len(diag.servers)} servers. Got {len(diag.failures)} failures.") print(f"Summary status: {diag.summary_status}")
Server usage
from diagonal import DiagnosticsServicer, ServiceStatusInfo from fred_api.fileman import service_fileman_grpc_pb2 # the service(s) provided by the server def my_service_status_callback() -> ServiceStatusInfo: ... # obtain the service status information diag = DiagnosticsServicer(server_version="1.0.0") services = diag.add_grpc_api(service_fileman_grpc_pb2) for service in services: diag.add_service_status(service, my_service_status_callback) diag.add_to_server(my_grpc_server)
ChangeLog
Releases
Unreleased
3.0.0 (2025-03-05)
- Add collect_server_diagnostics function (#12)
- Add DiagnosticsServicer (#13)
- Breaking changes (#12)
- Move client.About to schema.About
- Move and rename
- client.Service to schema.ServiceStatusInfo
- client.Status to constants.ServiceStatusCode
- Remove DiagnosticsDecoder.STATUS_CODE_ENUM
- Upgrade to fred-frgal ~= 4.1
- Drop Python 3.8 support
2.0.0 (2024-09-23)
- Upgrade to pydantic 2 (#11)
1.1.1 (2024-09-23)
- Upgrade to fred-frgal ~= 3.15 (#10)
1.1.0 (2024-06-24)
- Add Pydantic v1/v2 compatibility layer
- Add specific service exceptions
- DiagnosticsNotImplemented when server does not provide diagnostics service
- ServiceUnavailable when service is not available at all
1.0.0 (2022-12-21)
- Update project setup
- Bump version to 1.0.0
0.2.0 (2022-05-16)
- Use pydantic models
- Reformat code with Black
0.1.1 (2021-11-02)
- Expose DiagnosticsClient in __init__.py
0.1.0 (2021-10-18)
Initial version.