mobius-operations-trace-py
Request-flow reconstruction and HUMAN_API replay for Mobius Python (FastAPI)
services. Python port of platform-artifact-lifecycle-lib +
platform-artifact-lifecycle-web (MPH-926 / MPH-928), verified against
the Java source (OperationTraceServiceImpl, LifecycleOperationsExceptionHandler).
Relies on action-log rows carrying spanid / parentservicespanid /
requestid / httpmethod / httpurl / requesterid / actionsource, written
by mobius-tracer-py +
mobius-auditlog-py.
What it does
get_request_flow(txnid, requestid)— queries action logs (either identifier alone is enough) and rebuilds the causal call tree (HUMAN_APIentry point first, then each service hop it triggered, in call order) from thespanid/parentservicespanidfields.replay_request(txnid, requestid)— finds the originatingHUMAN_APIcall, exchanges the original requester's identity for a bearer token, and re-issues that exact HTTP call (method/URL/body).
Both are exposed as FastAPI endpoints:
GET /v1/operations/request-flows?txnid=...&requestid=...POST /v1/operations/request-replays?txnid=...&requestid=...
Error handling mirrors the Java REST layer:
- Internal failures (missing identifiers, PI lookup failure, missing
HUMAN_APIfields, replay connectivity failure) → HTTP 400 with the same envelopeLifecycleOperationsExceptionHandleremits (timestamp,origin,errorCode,errorMessage,httpStatusCode,actionsRequired). - A replayed target's own response — even a 4xx/5xx — is forwarded verbatim instead of raised, with the outer HTTP status set to match the target's.
Usage
This package has no hard dependency on a specific action-log store or IAM client — you supply small adapters:
from mobius_operations_trace import setup_operations_trace
setup_operations_trace(
app,
token_provider=my_token_provider, # TokenProvider protocol
instances_list_url="http://pi-service/v2.0/schemas/{schemaId}/instances/list",
schema_id="action-log-schema-id",
)
instances_list_url must contain a literal {schemaId} placeholder — PI
takes the schema id as a URL path variable, not a body field (matches
lifecycle.operations.trace.instances-list-url on the Java side). Pass
action_log_source instead of instances_list_url/schema_id to bypass the
built-in PI-backed source entirely.
TokenProvider has a single method, retrieve_token_from_tenant_id(tenant_id)
— used both to authenticate the PI query (with the fixed
PI_SERVICE_TENANT_ID) and to authenticate a replay as the original requester
(with the HUMAN_API row's requesterid), matching the Java side's single
IamVaultUtils.retrieveTokenFromTenantId method.
See mobius_operations_trace.pi_client.ActionLogSource and
mobius_operations_trace.tokens.TokenProvider for the full adapter contracts.
Release files for mobius-operations-trace-py 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mobius_operations_trace_py-1.0.0.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mobius_operations_trace_py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / mobius_operations_trace_py-1.0.0.tar.gz
| Download URL | mobius_operations_trace_py-1.0.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f602835b1c1f1dabe6f6d0d60ead0ad945e5740bc9a7d08281f2374ba11455ce
|
|
BLAKE2b-256 checksum How to use checksums |
34d213ccea5a95f61430c4f682a724727663e64f09c417024a2f0f43ee5f2a86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / mobius_operations_trace_py-1.0.0-py3-none-any.whl
| Download URL | mobius_operations_trace_py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
224e50134f2524b4e10d711cde9e57f2a05b7bd4d5ce38a907725f31de4bbfdd
|
|
BLAKE2b-256 checksum How to use checksums |
f29b53a43f1099bfa45c6d1763571d5b2f37a309fc15d1731061d2e986b8f2ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|